Using Java, write a GUI app using check boxes and combo boxes to create GUI obje
ID: 665725 • Letter: U
Question
Using Java, write a GUI app using check boxes and combo boxes to create GUI objects.
______________________________________
Cindy’s catering provides meals for parties and special events. Create an interactive GUI program that allows Cindy's Catering to better operate their business. The following data must be entered concerning the customer and the event:
• The customer’s name must be entered into a text field.
• The customer’s contact phone number into a text field.
• The number of guests invited to a Cindy catered event into a text field.
• The customer must choose one entrée from a group of at least four choices.
• The customer must choose up to two side dishes from a group of at least four choices.
• The customer must choose one desert from a group of at least three choices.
______________________________________
Display the cost of the event which is calculated as $35 per person.
To validate the input data, do the following:
• If the value entered for the number of guest is not numeric, set the event price to zero.
• If the user attempts to choose more than two side dishes, remove all the current side dish selections so that the user can start over.
______________________________________
After the final price for the dinner has been calculated, the event information must be saved to an output file so that Cindy’s Catering will have the information for the event. The items should be separated by spaces. If any item is not chosen, enter the word “none” for that item. The following fields must be written to the output file:
• the customer’s name
• the customer’s contact phone number
• the number of guests
• the one entrée chosen
• the two sides chosen
• the one desert chosen
______________________________________
Requirements
• The data input must be done with a GUI.
• The GUI must be defined in a programmer-defined class, namedCatering.java,rather than in the main class.
• The main class, named Cindy.java, should instantiate the class Catering.
• The output file should be named Event.txt.
Explanation / Answer
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.mycompany.cafeteria.test.respository; import com.mycompany.cafeteria.app.config.ConnectionConfig; import com.mycompany.cafeteria.domain.Customer; import com.mycompany.cafeteria.repository.CustomerRepository; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.testng.Assert; import static org.testng.Assert.*; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; /** * * @author Sibakhulu */ public class CustomerRepositoryTest { public static ApplicationContext ctx; private Long id; private CustomerRepository repo; public CustomerRepositoryTest() { } // TODO add test methods here. // The methods must be annotated with annotation @Test. For example: // @Test public void createCustomer(){ repo = ctx.getBean(CustomerRepository.class); Customer c = new Customer.Builder().id(id).name("Cindy") .lastname("Jacobs").build(); repo.save(c); id = c.getId(); Assert.assertNotNull(c); } @Test(dependsOnMethods = "createCustomer") public void readCustomer(){ repo = ctx.getBean(CustomerRepository.class); Customer customer = repo.findOne(id); Assert.assertEquals(customer.getFirstname(), "Cindy"); } @Test(dependsOnMethods = "readCustomer") private void updateCustomer(){ repo = ctx.getBean(CustomerRepository.class); Customer person = repo.findOne(id); Customer updatedCustomer = new Customer.Builder().name("Cindy").build(); repo.save(updatedCustomer); Customer newPerson = repo.findOne(id); Assert.assertEquals(newPerson.getFirstname(), "Cindy"); } @Test(dependsOnMethods = "updateCustomer") private void deletePerson(){ repo = ctx.getBean(CustomerRepository.class); Customer cust = repo.findOne(id); repo.delete(cust); Customer deletedCustomer = repo.findOne(id); Assert.assertNull(deletedCustomer); } @BeforeClass public static void setUpClass() throws Exception { ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class); } @AfterClass public static void tearDownClass() throws Exception { } @BeforeMethod public void setUpMethod() throws Exception { } @AfterMethod public void tearDownMethod() throws Exception { } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.