import java.io.*;
import java.util.*;
import java.util.Scanner;
public class cooperativeCanteen60 {
static Scanner console = new Scanner(System.in);
static Scanner sc = new Scanner(System.in);
public static void main(String[]args) {
//throws java.io.IOException
{
Scanner in = new Scanner (System.in);
int type;
int discountRange;
int discount;
int customerType;
int number;
int rtotal;
int vtotal;
int ftotal;
int mtotal;
int tcost = 0;
int tcost2 = 0;
int order;
int change;
int moneyReceived;
int price;
int rprice;
int fprice;
int vprice;
int mprice;
int quantity;
int rquantity;
int vquantity;
int fquantity;
int mquantity;
System.out.println("******COOPERATIVE CANTEEN******");
System.out.println("1]BudgetMeal");
System.out.println("2]RegularMeal");
System.out.println("Type of Order: [1 or 2]?");
type=console.nextInt();
System.out.println("1]Rice,Vegetable,Softdrink = 30.00");
System.out.println("2]Rice,Vegetable,Porkchop = 50.00");
System.out.println("3]Rice,Chicken,Softdrink = 40.00");
System.out.println("4]Rice,Vegetable,Meat,Softdrink = 60.00");
System.out.println("Your order is: [1,2,3 or 4]?");
order=console.nextInt();
System.out.print ("Number of order:");
quantity=in.nextInt();
System.out.print ("Price per serving:");
price=in.nextInt();
System.out.print ("Money Received:");
moneyReceived=in.nextInt();
tcost=quantity*price;
System.out.println("1]Employee = 5%");
System.out.println("2]Student = 20%");
System.out.println("3]Drop-by = 0%");
System.out.println("Discount: [1,2 or 3]?");
discount=console.nextInt();
change=console.nextInt();
if (type == 1);
{
System.out.println("\n\t*Budget Meal*");
switch (order) {
case 1:
System.out.println("\tYour order is: Rice,Vegetable,Softdrink"); break;
case 2:
System.out.println("\tYour order is: Rice,Vegetable,Porkchop"); break;
case 3:
System.out.println("\tYour order is: Rice,Chicken,Softdrink"); break;
case 4:
System.out.println("\tYour order is: Rice,Vegetable,Meat,Softdrink"); break;}
System.out.println("\tNumber of order:"+quantity);
System.out.println("\tPrice:"+tcost);
switch (discount) {
case 1:
System.out.println("\tDiscount: 5%"); break;
case 2:
System.out.println("\tDiscount: 20%"); break;
case 3:
System.out.println("\tDiscount: 0%"); break;}
System.out.println("\tMoney Received:"+moneyReceived);
switch (change) {
case 1:
System.out.println("\tChange:"+(moneyReceived-tcost*0.95)); break;
case 2:
System.out.println("\tChange:"+(moneyReceived-tcost*0.80)); break;
case 3:
System.out.println("\tChange:"+(moneyReceived-tcost*1));
break;
}
}
System.out.print ("Number of rice:");
rquantity=in.nextInt();
System.out.print ("Price per serving:");
rprice=in.nextInt();
rtotal=rquantity*rprice;
System.out.print ("Number of vegetable:");
vquantity=in.nextInt();
System.out.print ("Price per serving:");
vprice=in.nextInt();
vtotal=vquantity*vprice;
System.out.print ("Number of fish:");
fquantity=in.nextInt();
System.out.print ("Price per serving:");
fprice=in.nextInt();
ftotal=fquantity*fprice;
System.out.print ("Number of meat:");
mquantity=in.nextInt();
System.out.print ("Price per serving:");
mprice=in.nextInt();
mtotal=mquantity*mprice;
tcost2=rtotal + vtotal + ftotal + mtotal;
System.out.print ("Money Received:");
moneyReceived=in.nextInt();
System.out.println("1]Employee = 5%");
System.out.println("2]Student = 20%");
System.out.println("3]Drop-by = 0%");
System.out.println("Discount: [1,2 or 3]?");
discount=console.nextInt();
System.out.println("******COOPERATIVE CANTEEN******");
change=console.nextInt();
if (type == 2);
{
System.out.println("\n\t*Regular Meal*");
System.out.println("\tYour order are/is:");
System.out.println("\tNumber of rice:"+rquantity);
System.out.println("\tNumber of vegetable:"+vquantity);
System.out.println("\tNumber of fish:"+fquantity);
System.out.println("\tNumber of meat:"+mquantity);
System.out.println("\tPrice:"+tcost2);
switch (discount) {
case 1:
System.out.println("\tDiscount: 5%"); break;
case 2:
System.out.println("\tDiscount: 20%"); break;
case 3:
System.out.println("\tDiscount: 0%"); break;}
System.out.println("\tMoney Received:"+moneyReceived);
switch (change) {
case 1:
System.out.println("\tChange:"+(moneyReceived-tcost2*0.95)); break;
case 2:
System.out.println("\tChange:"+(moneyReceived-tcost2*0.80)); break;
case 3:
System.out.println("\tChange:"+(moneyReceived-tcost2*1));
break;}
}
}
}
}
JavaGr33nh0rn 0 Light Poster
Recommended Answers
Jump to Postdid you remove all those semicolons?
can you be a bit more specific? what is the value of type, and what is the output printed?
Jump to Postehm ... no it isn't?
just ran your code here, you've written it quite complicated and it's not that easy to follow the logic without knowing it, but I don't get that problem here.
can you post the code you have now?
Jump to Postwhat other one?
Jump to Postand ... what exactly is your question about this one?
Jump to Postwell, then you'll need to add a simple loop, but since this is another application, it might have been better if you started another thread for it.
All 18 Replies
JavaGr33nh0rn 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
JavaGr33nh0rn 0 Light Poster
stultuske 1,116 Posting Maven Featured Poster
JavaGr33nh0rn 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
stultuske 1,116 Posting Maven Featured Poster
JavaGr33nh0rn 0 Light Poster
JavaGr33nh0rn 0 Light Poster
stultuske 1,116 Posting Maven Featured Poster
JavaGr33nh0rn 0 Light Poster
JavaGr33nh0rn 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
stultuske 1,116 Posting Maven Featured Poster
JavaGr33nh0rn 0 Light Poster
JavaGr33nh0rn 0 Light Poster
stultuske 1,116 Posting Maven Featured Poster
JavaGr33nh0rn 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.