Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Help with Java assignment

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with Java assignment

    I have a java assignment for college that Im stuck on, if any one could help it would be great?

    A restaurant offers 4 main course options on its menu
    1. Turkey and Ham
    2. Steak (5 euro supplement)
    3. Nut Roast (Vegetarian)
    4. Lasagne
    A java program is required that first displays the menu then asks the user to enter the number of people in their party.
    For each person in the party theprogram should read their choice of main course.
    The program should count and display the number of each main course chosen, and the total cost of the booking. Each main course costs 22 euro, steak has a 5 euro supplement, the vegetarian option has a 3 euro discount.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Help with Java assignment

    Do you have any code you are having problems with?
    Please post the code, any error messages and any specific questions you have.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help with Java assignment

    import java.util.Scanner;
    public class P11AQ1
    {
       Scanner kb = new Scanner(System.in);
       int number, order;
    	double turkey&Ham = 22.00;
    	double steak = 27.00;
    	double nutRoast = 19.00;
    	double lasagne = 22.00;
    	double total;
       System.out.print("Enter number of People in party: ");
       number = kb.nextInt();
     
    	System.out.println("1. Turkey and Ham \n2. Steak (5 supplement) \n3. Nut roast (vegetarian) \n4. Lasagne");
    	System.out.println("Please chose main course: ");
    	order = kb.nextInt();
     
    	while(number <= order; order++)
    		{
    This is as far as i have got, not sure what to do next?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Help with Java assignment

    what to do next?
    Before starting to code a program, you should make a design for it and list the steps that the program needs to do to solve the problem.

    Have you compiled and tested the code that you've written so far?
    When it compiles without errors and tests ok
    then move on to the next step in the list of what the program needs to do.
    What's next in the list?


    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. java assignment; please help
    By willc86 in forum Java Theory & Questions
    Replies: 3
    Last Post: November 4th, 2012, 08:05 AM
  2. assignment troubles polymorphism (guide for assignment included)
    By tdawg422 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 8th, 2011, 11:01 AM
  3. Help with a java assignment?
    By rberry719 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: September 30th, 2011, 02:02 PM
  4. Java Assignment Help
    By welsh_rocker in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 12th, 2011, 06:02 AM
  5. Replies: 1
    Last Post: February 22nd, 2010, 08:20 AM