Results 1 to 4 of 4
Thread: can't manage to get this
- 12-26-2007, 04:19 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 4
- Rep Power
- 0
can't manage to get this
i need help with a programm,got a similar assigment and i just don't know where to start.pliz help me get the code.here is something close to what m working with.
The Perfect Party Catering Company caters meals for events assigned to them. You are required to design an event management system which will calculate the amount a client has to pay for the event depending on
the menu he / she has selected
the number of guests expected
the additional requests
An example of the menu which the client can choose from is as follows:
Menu Description Charge per head
A
Lamb / Chicken Chop
Salad
Mushroom Soup
Garlic Bread
Pasta
RM40.00
B 4 seasons
Sharks Fin Soup
Steamed Fish
Baby Kailan
Lemon Chicken
Fried Rice RM50.00
An example of the additional requests could include the following:
Item Description Charges per unit
1
Tent
RM400 per unit of 10 by 10 ft
2
Chairs
RM100 for 50 chairs
3
Tables
RM80 for 10 tables
4
Table cloths
RM20 for 10 table cloths
The menu and the additional requests are not restricted to the above listed. Kindly add more options and prices or make changes where necessary.
The client is given a discount for large parties according to the table below:
Number of guests Discount in %
1 25 0
26 50 3%
51 100 5%
101 200 8%
251 and over 10%
Please note that the discounts given are only for the food orders and not for the additional requests.
SECTION A : BASIC REQUIREMENTS OF THE SYSTEM
1. Main Menu
Your initial program design should display the following menu alternatives:
EVENT MANAGEMENT SYSTEM
O Order Module
P Payment Module
R Report Module
E Quit the program
2. Submenus
The following submenu will be displayed when O is selected:
ORDER MODULE
F to place orders for food
S to place orders for other services
M to return to Main Menu
The following submenu will be displayed when P is selected:
PAYMENT MODULE
T to display total amount to be paid
P to make payment
M to return to Main Menu
The following submenu will be displayed when R is selected:
REPORT MODULE
I to display the invoice for order made
S to display the summary of orders and payments made
M to return to Main Menu
- 12-26-2007, 04:47 AM #2
Have you even attempted it yet? If so, post some code and we may be able to assist you with wherever you are stuck. If not, you better get started - this is your assignment.
- 01-11-2008, 02:32 PM #3
Member
- Join Date
- Dec 2007
- Posts
- 4
- Rep Power
- 0
here's what i came up with.dont know where to start putting in calculations.
import java.io.*;
import java.util.*;
public class pr
{
public static void main(String[] args)
{
int a,b;
String number;
Scanner input = new Scanner(System.in);
System.out.println("\t\t+========================= ======================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println("\t\t1 - Order Module");
System.out.println("\t\t2 - Payment Module");
System.out.println("\t\t3 - Report Module");
System.out.println("\t\t4 - Quit the program");
System.out.println();
System.out.println("\t\tEnter 1,2,3 or 4 to make a selection");
number = input.nextLine();
a = number.charAt(0);
b = number.charAt(0);
switch (a)
{
case '0':System.out.println("\t\t+===================== ==========================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println("\t\t1 - Order Module");
System.out.println("\t\t2 - Payment Module");
System.out.println("\t\t3 - Report Module");
System.out.println("\t\t4 - Quit the program");
System.out.println();
System.out.println("\t\tEnter 1,2,3 or 4 to make a selection");
number = input.nextLine();
; break;
case '1':System.out.println("\t\t+===================== ==========================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println("\t\t\t\tORDER MODULE");
System.out.println("\t\t5 - to place orders for food");
System.out.println("\t\t6 - to place orders for other services");
System.out.println("\t\t0 - to return to Main Menu");
System.out.println("\t\t4 - Quit the program");
System.out.println();
System.out.println("\t\tEnter 5,6,0 or 4 to make a selection");
number = input.nextLine();
; break;
case '2':System.out.println("\t\t+===================== ==========================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println();
System.out.println("\t\tPAYMENT MODULE");
System.out.println("\t\t7 - to display total amount to be paid");
System.out.println("\t\t8 - to make payment");
System.out.println("\t\t0 - to return to Main Menu");
System.out.println("\t\t4 - Quit the program");
System.out.println();
System.out.println("\t\tEnter 7,8,0 or 4 to make a selection");
number = input.nextLine();
;break;
case '3':System.out.println("\t\t+===================== ==========================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println();
System.out.println("\t\tREPORT MODULE");
System.out.println("\t\t9- to display the invoice for order made");
System.out.println("\t\t10 - display the summary of orders and payments made ");
System.out.println("\t\tO - to return to Main Menu");
System.out.println("\t\t4 - Quit the program");
System.out.println();
System.out.println("\t\tEnter 9,10,0 or 4 to make a selection");
number = input.nextLine();
;break;
switch (b)
{
case '0':System.out.println("\t\t+===================== ==========================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println("\t\t1 - Order Module");
System.out.println("\t\t2 - Payment Module");
System.out.println("\t\t3 - Report Module");
System.out.println("\t\t4 - Quit the program");
System.out.println();
System.out.println("\t\tEnter 1,2,3 or 4 to make a selection");
number = input.nextLine();
; break;
case '5':System.out.println("\t\t+===================== ==========================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println("\t\t\t\tORDER MODULE");
System.out.println("\t\t place orders for food");
number = input.nextLine();
;break;
case'6': System.out.println("\t\t+========================= ======================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println("\t\t\t\tORDER MODULE");
System.out.println("\t\tplace orders for other services");
number = input.nextLine();
;break;
case'7': System.out.println("\t\t+========================= ======================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println();
System.out.println("\t\tPAYMENT MODULE");
System.out.println("\t\ttotal amount to be paid");
number = input.nextLine();
;break;
case'8': System.out.println("\t\t+========================= ======================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println();
System.out.println("\t\tPAYMENT MODULE");
System.out.println("\t\tto make payment");
number = input.nextLine();
;break;
case'9': System.out.println("\t\t+========================= ======================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println();
System.out.println("\t\tREPORT MODULE");
System.out.println("\t\tdisplay the invoice for order made");
number = input.nextLine();
;break;
case'1':System.out.println("\t\t+================= ==============================+");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t| *** EVENT MANAGEMENT SYSTEM *** |");
System.out.println("\t\t| *** *** |");
System.out.println("\t\t+========================= ======================+");
System.out.println();
System.out.println();
System.out.println("\t\tREPORT MODULE");
System.out.println("\t\tdisplay the summary of orders and payments made ");
number = input.nextLine();
;break;
}}}}
- 01-11-2008, 11:03 PM #4
I'm not sure how strict your instructor is, because you're not following the menu model already laid out where you are supposed to be getting input in the form of char's - not ints(ie: Enter 1, 2, 3, or 4 etc). Once you fix that, put this user interface into it's own class UserInterface from where you can easily instantiate it into a loop. Think about your assignment from a design perspective and not from a programming perspective when you begin, what classes have you considered for the items available from the menu? What values are you intending to keep track of and calculate? You might want to think about three separate classes for the different sub menu's data.
I changed the code a bit simply for viewing purposes, I found all those System.out.println's to be ugly - but that's just me. Just posting this in case you wanted to use it, you don't have to. Keep going - you can do this.
Java Code:public class Catering { public static void main(String[] args) { UserInterface ui = new UserInterface(); while (true) { ui.menu(); } } }Please use code tags when posting your code. Thank you.Java Code:import java.util.Scanner; public class UserInterface { public void menu() { int a, b; String number; Scanner input = new Scanner(System.in); System.out.print( "\t\t+========================= ======================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n" + "\t\t1 - Order Module\n" + "\t\t2 - Payment Module\n" + "\t\t3 - Report Module\n" + "\t\t4 - Quit the program\n\n" + "\t\tEnter 1,2,3 or 4 to make a selection: "); number = input.nextLine(); a = number.charAt(0); b = number.charAt(0); switch (a) { case '0': System.out.print( "\t\t+===================== ==========================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n" + "\t\t1 - Order Module\n" + "\t\t2 - Payment Module\n" + "\t\t3 - Report Module\n" + "\t\t4 - Quit the program\n\n" + "\t\tEnter 1,2,3 or 4 to make a selection: "); number = input.nextLine(); break; case '1': System.out.print( "\t\t+===================== ==========================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n" + "\t\t\t\tORDER MODULE\n" + "\t\t5 - to place orders for food\n" + "\t\t6 - to place orders for other services\n" + "\t\t0 - to return to Main Menu\n" + "\t\t4 - Quit the program\n\n" + "\t\tEnter 5,6,0 or 4 to make a selection: "); number = input.nextLine(); break; case '2': System.out.print( "\t\t+===================== ==========================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n\n" + "\t\tPAYMENT MODULE\n" + "\t\t7 - to display total amount to be paid\n" + "\t\t8 - to make payment\n" + "\t\t0 - to return to Main Menu\n" + "\t\t4 - Quit the program\n\n" + "\t\tEnter 7,8,0 or 4 to make a selection: "); number = input.nextLine(); break; case '3': System.out.print( "\t\t+===================== ==========================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n\n" + "\t\tREPORT MODULE\n" + "\t\t9- to display the invoice for order made\n" + "\t\t10 - display the summary of orders and payments made\n" + "\t\tO - to return to Main Menu\n" + "\t\t4 - Quit the program\n" + "\t\tEnter 9,10,0 or 4 to make a selection: "); number = input.nextLine(); break; } switch (b) { case '0': System.out.print( "\t\t+===================== ==========================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n" + "\t\t1 - Order Module\n" + "\t\t2 - Payment Module\n" + "\t\t3 - Report Module\n" + "\t\t4 - Quit the program\n\n" + "\t\tEnter 1,2,3 or 4 to make a selection: "); number = input.nextLine(); break; case '5': System.out.print( "\t\t+===================== ==========================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n" + "\t\t\t\tORDER MODULE\n" + "\t\t place orders for food\n"); number = input.nextLine(); break; case'6': System.out.print( "\t\t+========================= ======================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n" + "\t\t\t\tORDER MODULE\n" + "\t\tplace orders for other services\n"); number = input.nextLine(); break; case'7': System.out.print( "\t\t+========================= ======================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n\n" + "\t\tPAYMENT MODULE\n" + "\t\ttotal amount to be paid\n"); number = input.nextLine(); break; case'8': System.out.print( "\t\t+========================= ======================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t+========================= ======================+\n\n\n" + "\t\tPAYMENT MODULE\n" + "\t\tto make payment\n"); number = input.nextLine(); break; case'9': System.out.print( "\t\t+========================= ======================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n\n" + "\t\tREPORT MODULE\n" + "\t\tdisplay the invoice for order made\n"); number = input.nextLine(); break; case'1': System.out.print( "\t\t+================= ==============================+\n" + "\t\t| *** *** |\n" + "\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" + "\t\t| *** *** |\n" + "\t\t+========================= ======================+\n\n\n" + "\t\tREPORT MODULE\n" + "\t\tdisplay the summary of orders and payments made\n"); number = input.nextLine(); break; } } }Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice? Vote now!
Got a little Capt'n in you? (drink responsibly)


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks