JavaFX application for the Sublime Sandwich Shop. The user can order sandwiches by using list boxes and the application displays the price. Each sandwich should allow a choice of at least three main ingredients (chicken, for example) at three different prices. The user should also be able to choose between three different bread types. Use CheckBoxes for additional ingredients - lettuce, tomato, etc.
Create an ArrayList to hold all of the sandwiches associated with an order. Display information about all the sandwiches that were ordered.

Answers

Answer 1

Answer:

package GUI;  

import java.awt.*;  

import java.awt.event.*;  

import javax.swing.*;

// Class SandwichShop definition

public class SandwichShop

{

// Creates a string array for sandwich ingredients  

String sandwichIngredients [] = {"Chicken", "Mutton", "Veg"};

// Creates a string array for bread types

String breadTypes[] = {"Bloomer", "Cob", "Plait"};

// Container object declared

JFrame jf;

JPanel p1, p2, p3, p4, mainP;

// Component object declared

JList ingredient, bread;

JLabel ingL, breadL, amountL;

JTextField amountT;

JButton amountB, exitB;

// Default constructor definition

SandwichShop()

{

// Creates frame

jf = new JFrame("Sandwich Shop");

// Creates panels

p1 = new JPanel();

p2 = new JPanel();

p3 = new JPanel();

p4 = new JPanel();

mainP = new JPanel();

// Creates list box and adds string array

ingredient = new JList<String>(sandwichIngredients);

bread = new JList<String>(breadTypes);

// Creates labels

ingL = new JLabel("Select Sandwich Ingredients");

breadL = new JLabel("Select Bread Types");

amountL = new JLabel("Amount: ");

// Creates text field

amountT = new JTextField(5);

// Creates buttons

amountB = new JButton("Check Amount");

exitB = new JButton("Exit");

// Adds components to panels

p1.add(ingL);

p1.add(ingredient);

p2.add(breadL);

p2.add(bread);

p3.add(amountL);

p3.add(amountT);

p4.add(amountB);

p4.add(exitB);

// Adds panels to main panel

mainP.add(p1);

mainP.add(p2);

mainP.add(p3);

mainP.add(p4);

// Set the main panel layout to 4 rows and 1 column

mainP.setLayout(new GridLayout(4, 1));

// Adds main panel to frame

jf.add(mainP);

// Sets the frame visible property to true

jf.setVisible(true);

// Set the size of the frame to width 400 and height 150

jf.setSize(400, 300);

// Registers action listener to exit button using anonymous class

exitB.addActionListener(new ActionListener()

{

// Overrides the actionPerformed() method

public void actionPerformed(ActionEvent ae)

{

System.exit(0);

}// End of method

});// End of anonymous class

// Registers action listener to amount button using anonymous class

amountB.addActionListener(new ActionListener()

{

// Overrides the actionPerformed() method

public void actionPerformed(ActionEvent ae)

{

// Extracts index of the selected item from the list box

int indexIngredient = ingredient.getSelectedIndex();

int indexBread = bread.getSelectedIndex();

// Checks if ingredient index is 0 and bread index is 0

// then set the amount 100 in text field

if(indexIngredient == 0 && indexBread == 0)

amountT.setText("100");

// Checks if ingredient index is 0 and bread index is 1

// then set the amount 120 in text field

if(indexIngredient == 0 && indexBread == 1)

amountT.setText("120");

// Checks if ingredient index is 0 and bread index is 2

// then set the amount 160 in text field

if(indexIngredient == 0 && indexBread == 2)

amountT.setText("160");

// Checks if ingredient index is 1 and bread index is 0

// then set the amount 190 in text field

if(indexIngredient == 1 && indexBread == 0)

amountT.setText("190");

// Checks if ingredient index is 1 and bread index is 1

// then set the amount 205 in text field

if(indexIngredient == 1 && indexBread == 1)

amountT.setText("205");

// Checks if ingredient index is 1 and bread index is 2

// then set the amount 210 in text field

if(indexIngredient == 1 && indexBread == 2)

amountT.setText("210");

// Checks if ingredient index is 2 and bread index is 0

// then set the amount 97 in text field

if(indexIngredient == 2 && indexBread == 0)

amountT.setText("97");

// Checks if ingredient index is 2 and bread index is 1

// then set the amount 85 in text field

if(indexIngredient == 2 && indexBread == 1)

amountT.setText("85");

// Checks if ingredient index is 2 and bread index is 2

// then set the amount 70 in text field

if(indexIngredient == 2 && indexBread == 2)

amountT.setText("70");

}// End of method

});// End of anonymous class

}// End of default constructor

// main function definition

public static void main(String[] args)

{

// Creates an anonymous object by calling default constructor

new SandwichShop();

}// End of main method

}// End of class

Output:

JavaFX Application For The Sublime Sandwich Shop. The User Can Order Sandwiches By Using List Boxes And

Related Questions

Which term refers to the use of expressions to check consistency in relation to other fields in the same record?
O data validation
O record validation
O input mask
O validation text

Answers

This is the answer 3 due to the thought me

The  term validation text refers to the use of expressions to check consistency in relation to other fields in the same record.

What is the use of validation text?

The term Validation text is known to be one that helps a user to be able to have a message that can help them to be able to input data that is said to be not valid.

Conclusively, Validations rules is known to aid one in that one can check data for accuracy and consistency in terms of  data entry.

Learn more about Validation text from

https://brainly.com/question/12069810

#SPJ2

Help Pls
I need about 5 advantages of E-learning​

Answers

Answer:

Explanation:

E-learning saves time and money. With online learning, your learners can access content anywhere and anytime. ...

E-learning leads to better retention. ...

E-learning is consistent. ...

E-learning is scalable. ...

E-learning offers personalization.

Answer:

E- learning saves time and money

E-learning makes work easier and faster

E- learning is convenient

E- learning is consistent

E- learning is scalable

Explanation:

when you learn using the internet, you save a lot of time by just typing and not searching through books

Write a method, including the method header, that will receive an array of integers and will return the average of all the integers. Be sure to use the return statement as the last statement in the method. A method that receives an array as a parameter should define the data type and the name of the array with brackets, but not indicate the size of the array in the parameter. A method that returns the average value should have double as the return type, and not void. For example: public static returnType methodName(dataType arrayName[]) 3 The array being passed as a parameter to the method will have 10 integer numbers, ranging from 1 to 50. The average, avgNum, should be both printed in the method, and then returned by the method. To print a double with 2 decimal points precision, so use the following code to format the output: System.out.printf("The average of all 10 numbers is %.2f\n", avgNum);

Answers

Answer:

The method is as follows:

public static double average(int [] arrs){

    double sum = 0,avgNum;

    for(int i = 0;i<arrs.length;i++){

        sum+=arrs[i];

    }

    avgNum = sum/arrs.length;

    System.out.printf("The average of all numbers is %.2f\n", avgNum);

    return avgNum;

}

Explanation:

This defines the method

public static double average(int [] arrs){

This declares sum and avgNum as double; sum is then initialized to 0

    double sum = 0,avgNum;

This iterates through the array

    for(int i = 0;i<arrs.length;i++){

This adds up the array elements

        sum+=arrs[i];     }

This calculates the average

    avgNum = sum/arrs.length;

This prints the average to 2 decimal places

    System.out.printf("The average of all numbers is %.2f\n",

avgNum);

This returns the average to main

    return avgNum; }

Why use LinkedIn automation for LinkedIn?

Answers

Answer:

Using LinkedIn automation tools to run successful outreach campaigns has become popular. It’s because these tools automate tedious networking tasks such as visiting profiles, collecting data, sending out bulk connection requests, messages, and follow-ups, etc.  

With the help of the latest LinkedIn automation tools, you can quickly perform all the repetitive tasks while saving yourself a lot of time that you can use on actual relationship building and lead nurturing tasks.  

However, LinkedIn isn’t really amused when using any bots or automation tools for LinkedIn.

An organization needs to integrate with a third-party cloud application. The organization has 15000 users and does not want to allow the cloud provider to query its LDAP authentication server directly. Which of the following is the BEST way for the organization to integrate with the cloud application?

a. Upload a separate list of users and passwords with a batch import.
b. Distribute hardware tokens to the users for authentication to the cloud
c. Implement SAML with the organization's server acting as the identity provider.
d. Configure a RADIUS federation between the organization and the cloud provider

Answers

Answer:

The BEST way for the organization to integrate with the cloud application is:

c. Implement SAML with the organization's server acting as the identity provider.

Explanation:

Implementing SAML (Security Assertion Markup Language) integrations will provide more security to the organization (identity provider) as users' credentials are exposed to fewer parties.  SAML authenticates the users to the cloud application provider.  SAML enables the organization to pass authorization credentials to the service provider by transferring the users' identities to the service provider.

DESCRIBE THE GENERAL STRATEGY BEHIND DEALOCK PREVENTION AND GIVE A PRATICAL EXAMPLE

Answers

Answer:

........

Explanation:..........

what is the build in libary function to compare two strings?​

Answers

Answer:

strcmp() is a built-in library function and is declared in <string. h> header file. This function takes two strings as arguments and compare these two strings lexicographically.

Explanation:

Hope it helps

The advantage of returning a structure type from a function when compared to returning a fundamental type is that a. the function can return multiple values b. the function can return an object c. the function doesn’t need to include a return statement d. all of the above e. a and b only

Answers

Answer:

The advantage of returning a structure type from a function when compared to returning a fundamental type is that

e. a and b only.

Explanation:

One advantage of returning a structure type from a function vis-a-vis returning a fundamental type is that the function can return multiple values.  The second advantage is that the function can return can an object.  This implies that a function in a structure type can be passed from one function to another.

Question No: 9 Of 50 Time Left : 59:18
ОА
QUESTION
Which of the following two entities (reading from Left to right) can be connected by the dot operator?
A class member and a class object.
A class object and a class,
A constructor and a member of that class.
OB
Ос
OD
A class object and a member of that class.

Answers

Answer:b

Explanation:

to get points

Other Questions
What is price index number? Northberg Company is preparing a cash budget for August. The company has $16,000 cash at the beginning of August and anticipates $126,000 in cash receipts and $134,500 in cash payments during August. Northberg Company wants to maintain a minimum cash balance of $15,000. To maintain the $15,000 required balance, during August the company must: Group of answer choices Borrow $15,000. Repay $7,500. Repay $8,500. Borrow $7,500. Borrow $8,500. The difference in income between the richest and poorest citizens is called |Area of a square field is 617796cm . Find length of its each side. Please help explanation if possible NEED HELP ASAPPPPP !!! rachel rides her bicycle due east at 9 miles per hour amos rides his bicycle due north at 12 miles per hour if they left from the same point at the same time how far apart will they be after 1 hour Kh khn ln nht ca min nam trung b v nam b v kh hu l Science, Geology, Class 81. choose the correct answer ( CTCA )a. what makes the soil fertile?i. rock particles ii. humusiii. sand particlesiv. silt particles Read this short story, and write the correct imperfect forms of the verbs in parentheses in the space provided below. Be sure to number your answers.Un Da en la Escuela(1)___Ser)___ lunes. A Paco no le (2)___(gustar)___ los lunes porque (3)___(tener)___ que ir a la clase de ingls. El amigo de Paco se (4)___(llamar)___ Pepe. Paco y Pepe siempre (5)___(Ir)___ juntos a la clase de ingls. El maestro de la clase de ingls se llamaba Seor Alcachofa. El Seor Alcachofa era muy exigente. El problema era que Paco no (6)___(haber)___ hecho su tarea. Mientras Paco (7)___(pensar)___ en una excusa, su amigo Pepe le dijo "Puedes copiar mi tarea." Paco lo (8)___(considerar)___ mientras (9)___(esperar)___ que empezara la clase. Entonces, Paco pens en las palabras de su padre: "Honra y dinero se ganan despacio y se pierden ligero." Paco decidi ser honesto y dijo sinceramente al Seor Alcachofa que no hizo su tarea. Despus de hacerlo, Paco se sinti mejor. Paco (10)___(saber)___ que haba hecho lo justo.Can you just make the numbered words in imperfect form? Carrie is asked to draw a triangle with the following specification at least two angles measuring 60Which of the following statements about this triangle is true?A. One and only one triangle exists with the given condition, and it must be an equilateral triangle.More than one triangle exists with the given condition, and all instances must be equilateral trianglesCOne and only one triangle exists with the given condition, and it must be an isosceles triangleDMore than one triangle exists with the given condition, and all instances must be isosceles triangles 5. What are powers that are unique to Congress? Cross-contamination of food occurs when a. perishable foods are kept at room temperature for more than 2 hours b. a utensil contaminated with a microorganism from a previously handled food contacts a second food c. two or more food handlers work on the same food d. two or more microorganisms grow in the same food Anna _______ homework every day. A. doB. will be doingC. doesD. had done Pippa had 35 stickers. She gave an equal number of stickers to 8 friends. She gave each friend as many stickers as possible and kept the rest for herself. How many stickers did Pippa keep for herself? What is the misconception which might lead some to select D) 27 A) 3 B) 4 C) 11 D) 27 Why use LinkedIn automation for LinkedIn? where and in which condition gold is found? Cho a thc f(x) = bit rng f(1)=f(-1); f(2)=f(-2).Chn cu ng :A. f ( x ) = f ( x) vi mi xB. f ( x ) = f ( x) vi mi xC. f ( x ) = 2 f ( x) vi mi xD. f ( x ) = 3 f ( x) vi mi x About what issue did Ballinger and Pinchot disagree? Roger is hired by an international HR consulting firm as its Outplacement Counselor. Prior to receiving extensive training on the company's copyrighted techniques and programs, Roger is asked to agree in his employment contract that he will not work as a trainer for a rival outplacement company in a specified list of states for a period of one year from the time he quits or his employment will be terminated. This best exemplifies a _____. Group of answer choices