Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @(#)billingsystem.java
- *//this program is for using a simple calculator for 5 functions
- *//the while statement is the user's choice whether he/she wants to continue
- *
- @author
- *
- @version 1.00 2013/10/4 */
- public class billingsystem
- {
- public static void main(String[] args)
- {
- int ID;
- int amount;
- double total = 0;
- char more = 'y';
- double billTotal = 0;
- while(more == 'y')//until n is entered
- {
- System.out.println("What would you like to buy?");
- System.out.println("[1001)soda | 1002)chips | 1003)candy/chocolate | 1004)pizza]");
- ID = TextIO.getInt(); //accept choice as integer
- System.out.println("How many of these do you want?");
- amount = TextIO.getInt();
- if(ID == 1001)
- {
- total = amount*9.90;
- }
- if(ID == 1002)
- {
- total = amount*14.75;
- }
- if(ID == 1003)
- {
- total = amount*19.60;
- }
- if(ID == 1004)
- {
- total = amount*35.50;
- }
- System.out.println("Do you want more?");
- System.out.println("[y | n]");
- more = TextIO.getChar(); //accept choice as character
- if(more == 'n')
- {
- billTotal = total + 3.45;
- System.out.println("Your total is " + billTotal + " DKK");
- }//class ends
- }//while ends here
- }//class ends here
- }//program ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement