Question
A.Profits.java A grocery store sells many cases of soft drink every day. In each case, there are 12 bottles and the store profits 20 cents
A.Profits.java
A grocery store sells many cases of soft drink every day. In each case, there are 12 bottles and the store profits 20 cents per bottle. We want to compute the profit that the store has every day of selling soft drink. We also want to know the profit for selling soft drink in a year. Assume a year is 365 days.
1) Problem Definition:
Compute the profit that a store has in one day for selling soft drink?
Compute the profit that a store has in one year for selling soft drink?
2) Program Design - Algorithm
Before we attempt to write the program, let's develop an algorithm for solving the problem.
Exercise 2.1
Design the algorithm for this problem written in Pseudo Code (plain English). Remember your algorithm must be precise. This algorithm must be translated to java code to obtain the program.
3) Desktop Testing- Trace Table
Now that you have the algorithm, create a Trace Table to test your algorithm and see if it works on paper. Remember, your table should have two columns, one for the variables and the other for expected output.
4) Implementing the Algorithm into Java Code
Exercise 2.2
This is where you will translate the algorithm to Java Code. Write a program called Profits.java that is designed based on the algorithm that is given in the previous part.
// This Java Program will compute the profit of selling soft drinks
public class Profits
{
public static void main(String [] args )
{
}
}
4) Test the Program
The last thing you need to do is to test the program to make sure it produces the correct results. Assuming the store sells 10 cases per day, what would be the profit per day and per year? You can confirm the answer by hand.
Exercise 2.3
Modify your program so that it uses 22 Cents profit per bottle in the calculations. This time in your output, display both the number of bottles sold and the profit for one day, one year, and 10 years.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Exercise 21 Algorithm in Pseudo Code Algorithm to Compute Profit from Selling Soft Drinks 1 Initiali...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started