8. We want to conduct a breakeven analysis for a wooden baseball bat manufacture
ID: 3691038 • Letter: 8
Question
8. We want to conduct a breakeven analysis for a wooden baseball bat manufacturer who is
interested in diversifying their product line. As a reminder breakeven analysis was discussed
previously in the Graphing Solutions chapter, specifically in Example 11-9. Currently, the
manufacturer produces white ash bats; they are interested in purchasing a second machine
line to produce either maple or bamboo baseball bats.
To help the manufacturer look at the different scenarios, write a program that asks the
user of the program to input the following variables IN THIS SPECIFIC ORDER:
Selling price of a maple bat (in dollars)
Selling price of a bamboo bat (in dollars)
The total number of bats the manufacturer can produce per week; this value is the same
for either type of bat
The number of weeks the manufacturer plans to run their bat production machinery in
a year
The manufacturing process can only make a single type of bat each week, and will produce
the same number of bats in a week regardless of the material used.
Revenue is determined as the selling price of an object times the number of objects. Your
program should display the total revenue generated for the scenario, as shown below:
Producing ## bats a week for ## weeks in a year will generate:
Maple bat revenue: $####.##
Bamboo bat revenue: $####.##
Total number of bats produced: #.###e+##
The revenue should be displayed with two decimal places and the total number of bats
produced should be displayed in exponential notation with three decimal places.
In addition, each revenue line should display with a single tab at the front of each
sentence, as shown above. The “#” character in the output displayed above will be actual
numbers in the program you create.
Sample Input/Output. The highlighted values are entered by the user:
Type the selling price of a maple bat (in dollars): 16
Type the selling price of a bamboo bat (in dollars): 24
Type total number of bats manufacturer can produce per week: 50
Type number of weeks manufacturer plans to run production: 50
Producing 50 bats a week for 50 weeks will generate:
Maple bat revenue: $40000.00
Bamboo bat revenue: $60000.00
Total number of bats produced: 2.500e+03
Explanation / Answer
Please find the following answer:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class BaseballProject {
static int priceOfMapleBats=0;
static int priceOfBamboBats=0;
static int runPeryear=0; // No. of week the factory will run
static int batsPerWeek=0;
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
BaseballProject bp=new BaseballProject();
bp.setValues();
bp.revenuGenerator(priceOfMapleBats,priceOfBamboBats,runPeryear, batsPerWeek);
}
public void setValues() throws NumberFormatException, IOException{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Type the selling price of a maple bat in dollers");
this.priceOfMapleBats=Integer.parseInt(br.readLine());
System.out.println("Type the selling price of a bamboo bat in dollers");
this.priceOfBamboBats=Integer.parseInt(br.readLine());
System.out.println("Type total number of bats manufacturer can produce per week");
this.batsPerWeek=Integer.parseInt(br.readLine());
System.out.println("Type number of weeks manufacturer plans to run production");
this.runPeryear=Integer.parseInt(br.readLine());
}
public void revenuGenerator(int priceOfMapleBats,int priceOfBamboBats,int runPeryear, int batsPerWeek ){
Double revenuOfMapleBat= (double) (priceOfMapleBats *runPeryear*batsPerWeek);
Double revenuOfBambooBat=(double)(priceOfBamboBats*runPeryear*batsPerWeek);
System.out.println("Revenue of Maple bat "+revenuOfMapleBat);
System.out.println("Revenue of Bamboo bat "+revenuOfBambooBat);
NumberFormat formatter = new DecimalFormat("0.000E0");
System.out.println(formatter.format(runPeryear*batsPerWeek));
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.