this has to be done in Java Create packages as needed per design Create classes
ID: 3701737 • Letter: T
Question
this has to be done in Java
Create packages as needed per design Create classes modeling the purchase of sandwich /sandwiches at a typical sandwich shop. Use three objects: Cashier, Customer, SandwichMaker. (You can add more classes if you want but these three should be present in the project) Follow the steps to complete the homework: 1. Create a sequence/ flow diagram This diagram would show how an interaction is initiated. 2. 3. Also it shows which class will initiate which other class Indicate what information (if any) is passed between the classes Figure out what instance variables will be needed in each of the classes 4. Create UML diagrams The UML diagrams should follow the exact formatting shown in class 5. 6. 7. slides. Submit UML diagrams in a separate folder as images with your code submission. Create all the classes Create a driver class (SandwichDriver) to test the functionality Handle all possible errors with try catch blocks wherever necessaryExplanation / Answer
package chegg;
public class SandwichShop {
private float price;
private int quantity;
private double amount;
private String customerName;
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
//cashier will get the name of Customer and calculate the amount
public void calculateAmount(String cName)
{
this.setAmount(this.getPrice() *this.getQuantity());
System.out.println("Customer Name :"+cName + " Amount :"+this.getAmount());
}
//info got from customer will be set here
public void setInfo(String cName , int quantity , float price)
{
setCustomerName( cName);
setQuantity(quantity);
setPrice(price);
}
//make sandwich to inform sandwich maker
public void makeSandwich()
{
System.out.println("Make sandwich");
}
public static void main(String[] arg)
{
//Testing cashier condition
SandwichShop cashier = new SandwichShop();
cashier.setInfo("Steve", 2, 12.5f);
cashier.calculateAmount(cashier.getCustomerName());
}
}
The info i get from the question i submitted please comment for more information and i know something more you want comment for that.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.