Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How do I make it so I can add decimals to the amount and quantity and also recieve a correct decimal
How do I make it so I can add decimals to the amount and quantity and also recieve a correct decimal [message #1007677] Thu, 07 February 2013 02:52 Go to next message
Joseph Charles is currently offline Joseph CharlesFriend
Messages: 1
Registered: February 2013
Junior Member
import java.util.Scanner;

public class Percentage {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

final double percent = 100;
System.out.println("How much does the item cost: ");
double Amount = input.nextInt();
System.out.println("Insert the quantity of the object: ");
double quantity = input.nextInt();
double x = Amount * percent / quantity;

System.out.println("Cost per ounce is " + x);


}

}
Re: How do I make it so I can add decimals to the amount and quantity and also recieve a correct dec [message #1007840 is a reply to message #1007677] Thu, 07 February 2013 17:20 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi,

i am not sure how this is related to xtext?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Creating RCP, no executable
Next Topic:Syntactic predicates in 0.8M4
Goto Forum:
  


Current Time: Fri Apr 26 19:44:05 GMT 2024

Powered by FUDForum. Page generated in 0.03167 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top