Question: file 6 package asmt01; public class Tester { public static void main(String[] args) { try { // Price for x of BB Bread brownBread =

file 6

package asmt01;

public class Tester {

public static void main(String[] args) {

try {

// Price for x of BB

Bread brownBread = new BrownBread("BB", 5);

System.out.println("BrownBread: $"

+ brownBread.calculateTypePrice());

// Price for x of MB

Bread multiSeeds = new MultiSeedsBread("MB", 10);

System.out.println("MultiSeedsBread: $"

+ multiSeeds.calculateTypePrice());

// Price for x of RB

Bread ryeBread = new RyeBread("RB", 15);

System.out.println("Ryebread: $"

+ ryeBread.calculateTypePrice());

// Total Earnings

double totalEarnings

= ryeBread.calculateTypePrice()

+ brownBread.calculateTypePrice()

+ multiSeeds.calculateTypePrice();

System.out.println("Total earnings: $"

+ totalEarnings);

// Number of loaves for a given bread type and money amount

Person person = new Person("BB", 25);

System.out.println(" You may buy "

+ person.calculatePossibleBreadBought() + " of this"

+ " type of bread.");

} catch (IllegalArgumentException illArgExc) {

System.out.println(illArgExc.getMessage());

}

}

}

file 5

package asmt01;

public class RyeBread extends Bread {

protected static final double PRICE_PER_ITEM = 1.3;

public RyeBread(String name, int amount) {

}

public String getName() {

}

public void setName(String name) {

}

public double calculateTypePrice() {

}

}

file 4

package asmt01;

public class Person {

private String name;

private double money;

public Person(String name, double money) {

}

public String getName() {

}

private void setName(String name) {

}

public double getMoney() {

}

private void setMoney(double money) {

}

public int calculatePossibleBreadBought() {

switch (this.getName()) {

}

return possibleBuyings;

}

}

file 3

package asmt01;

public class MultiSeedsBread extends Bread {

protected static final double PRICE_PER_ITEM = 1.2;

public MultiSeedsBread(String name, int amount) {

}

public String getName() {

}

public void setName(String name) {

}

public double calculateTypePrice() {

}

}

file 2

package asmt01;

public class BrownBread extends Bread {

protected static final double PRICE_PER_ITEM = 1.1;

public BrownBread(String name, int amount) {

}

public String getName() {

}

public void setName(String name) {

}

public double calculateTypePrice() {

}

}

file 1

package asmt01;

public abstract class Bread {

private String name;

private int amount;

public Bread(String name, int amount) {

}

public String getName() {

}

public void setName(String name) {

}

public int getAmount() {

}

private void setAmount(int amount) {

}

public abstract double calculateTypePrice();

}

file 6 package asmt01; public class Tester { public static void main(String[]

args) { try { // Price for x of BB Bread brownBread

A previous programmer left some code (at http: //csc220.ducta.net/Assignments/Assignment-01-Code.zip). Please continue implementing the code to produce the following output: run: BrownBread: $5.5 MultiSeedsBread: $12.0 Ryebread: $19.5 Total earnings: $37.0 You may buy 22 of this type of bread. "TesterAskUser" is an interactive version of "Tester". a. "TesterAskUser" askes users for a type of bread and a number of loaves they want to buy then tell them how much the total is for each type of bread. It also gives the owner the total earnings. b. If a user tells "TesterAskUser" an amount the user wants to spend and the type of bread the user wants to buy, "TesterAskUser" lets the user know how many loaves of that bread type the user may buy. c. You need to handle IllegalArgumentException ()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!