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:
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.
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)
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)?");
If anyone could get me started in the right direction I'd really appreciate it.
have you learned about functions yet?
and, shouldn't n1 be a double ?
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.