Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the provided template, write and test the following program. When you are done: You must also run this code in NetBeans, and submit a

Using the provided template, write and test the following program.

When you are done: You must also run this code in NetBeans, and submit a screen shot, for full credit. See the Topic 3 Assignments page in WorldClass for details.

PROGRAM: Suppose a company wanted to copy and distribute a training manual. Some of the pages have pictures, and must be printed in color. Others, containing only text, can be printed in black and white. You are given the task of writing a program to determine how much it will cost.

Be sure to use the proper naming conventions for any constants or variables that you create,

(1) The template code has already defined an integer type variable to hold the number of color pages. Add two additional integer type variables to hold the number of black and white pages and total pages.

And add a Scanner variable to read input.

Prompt the user for the number of black and white pages and number of color pages and read the values. Display one blank line after reading the input, then calculate and output the total number of pages in the manual.

(2)Color copies are priced at 6 cents per page. Black and white copies are priced at 4 cents per page. The template code has already defined a double type constant for the color page cost. Add another double type constant for the black and white page cost.

(3)Each manual will also have a front and back cover, and its printing cost will vary, depending on the manual. Add a double type variable to hold the cover cost (one cost that includes both covers).

Extend the program to display another blank line, and prompt the user for cover cost and read the value. Then calculate and output the printing costs for one complete manual, as shown below, after adding any necessary variables.

Each manual must be mailed to one employee. Mailing costs for large envelopes are based on weight The first ounce is 98 cents, and each additional ounce is 21 cents. Store these values using double constants.

The company has determined that every 6.1 pages of paper weighs one ounce. Store this value using a double constant. The front and back covers together weigh 2 ounces. Store this value using an integer constant.

Extend the program to output another blank line, and then calculate and output the number of whole ounces that each manual weighs, and what it will cost to mail. HINT: Use a Math function to round the weight value up to the nearest whole ounces (and store the value in a double type variable).

/*

* Program description: (FILL IN DESCRIPTION)

* Author: (FIX ME -- FILL IN YOUR FIRST AND LAST NAME)

*/

import java.util.Scanner; // Note: Needed for user input

public class TrainingManualCostCalculator {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

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 Databases questions

Question

What is conservative approach ?

Answered: 1 week ago

Question

What are the basic financial decisions ?

Answered: 1 week ago