Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this particular program for class and don't know where to start Problem: Memorial Jr. High wants to raise money for a

I need help with this particular program for class and don't know where to start

Problem:

Memorial Jr. High wants to raise money for a new score board by having a Candy Sale.They have decided to use "Sweetie Treaties" to purchase the following items for sale:

Hard Candy:Peanut Brittle and Peppermint

Soft Candy:Taffy, Chocolate and Gummi Bears

The products are delivered in cases. Each case holds 50 items.Orders are taken by the case only.

You will need to create three classes.

The first class is your main method. Name this class CandySaleApp. The driver class will be used to calculate the profits and to display the final information.

The second class will process orders for your Hard Candies. Name this class HardCandySale.

The third class will process orders for your Soft Candies. This class is to be named SoftCandySale.

Design:

The classes should be placed in a package with the name edu.ilstu

Your Non-application classes "HardCandySale" and "SoftCandySale" should have complete Javadoc comments.

The first class is the HardCandySale class:

HardCandySale class

This class is needed to keep track of the information for each HardCandySale order.This class should include the following:

Named Constants

oPrices

Peanut Brittle $11.00

Peppermint $8.00

oExpected profit for the school is based on the number of cases of hard candy sold:

a constant for tier 1 share of (ProfitShare1) 7% or

a constant for tier 2 share of (ProfitShare2) 12%

Instance Variables

o2 instance variables for the counts of how many of each hard candy case are ordered

Methods

oGetters for each instance variable

oGetter for all the constants

oSetters for the count instance fields

oA method, calculateHardCandyCost, that will calculate the total cost of the Hard Candy orders based on the Hard Candy prices and the count of the orders.

The next class is the SoftCandySale class:

SoftCandySale class

This class is needed to keep track of the information for each SoftCandySale order.This class should include the following:

Named Constants

oPrices

Taffy $7.00

Chocolate $25.00

Gummi Bears $12.00

oExpected profit for the school is based on the number of cases of soft candy sold:

a constant for tier 1 share of (ProfitShare1) 7% or

a constant for tier 2 share of (ProfitShare2) 12%

Instance Variables

o2 instance variables for the counts of how many of each soft candy case are ordered

Methods

oGetters for each instance variable

oGetter for all the constants

oSetters for the count instance fields

oA method, calculateSoftCandyCost, that will calculate the total cost of the Soft Candy orders based on the Soft Candy prices and the count of the orders.

CandySaleApp class

This is the starting point for the application which is the only class to contain a main method.

This driver class will be used to calculate the profits and to display the final information.

You will use the both the HardCandyClass and SoftCandyClass classes here. For this program, the main method handles all of the input and output for the program and will the following tasks:

Create the instance of HardCandySale and the SoftCandySale classes

Follow the sample interaction on what to display for prompts, labels, messages and the flow for screen input and outputs.

oAsk for how many cases the user wants to order for each Hard Candy's type, and each Soft Candy's type

oUpdate the CandySale instance with the order numbers entered.

oAdd the Hard Candy together

oAdd the Soft Candy together

oDisplay a summary of the order, see sample run.

oA method, calculateHardCandySchoolProfit, that will calculate the share of the profits that will go Memorial Jr. High.Calculate as follows:

If the total count of the Hard Candy orders (whether ordering 1 or more of the flavors) is 9 or below, apply the tier1 share percentage of 7%.Otherwise, use the tier 2 percentage.

oA method, calculateSoftCandySchoolProfit, that will calculate the share of the profits that will go Memorial Jr. High.Calculate as follows:

If the total count of the SoftCandy orders (whether ordering 1 or more of the flavors) is 7 or below, apply the tier1 share percentage of 7%.Otherwise, use the tier 2 percentage.

oA method calculateTotalNetCost, that will calculate and net cost that will be due and paid to the Sweetie Treaties company.This will be total cost of the order less the share for the new score board.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

=+ How can they slow an economic recovery?

Answered: 1 week ago