Results 1 to 3 of 3
  1. #1
    np2392 is offline Member
    Join Date
    Sep 2010
    Rep Power

    Default Help designing a program

    My professor wants us to write a program that will allow a user to build their own quesadilla, selecting y/n for each part. He also wants us to use constants.

    This is what I have:

    Java Code:
    import java.util.Scanner;
    public class Quesadila 
        public static final double GRILLED_VEGETABLES = 1;
        public static final double SPINACH = 1;
        public static final double BROCCOLI = 1;
        public static final double SPICY_BEEF = 2;
        public static final double SHREDDED_CHICKEN = 2;
        public static final double PICADILLO = 2;
        public static final double GRILLED_CHICKEN_BREAST = 2.25;
        public static final double IN_A_CHILI_SAUCE = 2.25;
        public static final double SHRIMP_WITH_SPICY_RED_SALSA = 3;
        public static void main(String[] args)
            int n1;
            n1 = 5;
            System.out.println("Welcome to Build a Quesadilla!");
            System.out.println("Here are your options:");
            System.out.println("Basic Quesadilla: $5");
            System.out.println("Add Grilled Vegetables, Spinach, or Broccoli: $1 each");
            System.out.println("Add Spicy Beef, SHredded Chicken, or Picadillo: $2 each");
            System.out.println("Add Grilled Chicken Breat or In a Chili Sauca: $2.25 each");
            System.out.println("Add Shrimp with Spicy Red Salsa: $3");
            System.out.println("Do you want Grilled Vegetables (y/n)?");    
    All the prices and such were given to us. Basically I need to ask the user to input either y or n for each item, then have the program check what was inputted, and if y was inputted I have to add the value of the constant to n1, then at the end just display n1.

    If anyone could get me started in the right direction I'd really appreciate it.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Rep Power


    have you learned about functions yet?

    and, shouldn't n1 be a double ?

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    There are many sample programs on this forum that use the Scanner class to read input from the user. Use Search for Scanner to find them.

Similar Threads

  1. Problem in JSP Page Designing
    By vinothkumarrvk in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-10-2010, 07:16 AM
  2. Replies: 0
    Last Post: 11-04-2009, 10:09 PM
  3. designing application in swing
    By programmer_007 in forum AWT / Swing
    Replies: 12
    Last Post: 09-03-2009, 08:50 PM
  4. Need help for coding and designing
    By g.ganiraju in forum New To Java
    Replies: 11
    Last Post: 11-01-2008, 05:49 AM
  5. advise on designing an ejb application
    By bobD in forum New To Java
    Replies: 0
    Last Post: 09-03-2008, 10:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts