PrintingService Program
Description
Suppose that the cost of printing large photos (24 x 36) is calculated as follows:- Service charge $3.00
- $7.99 per copy for the first 10 copies
- $7.25 for each addition copy
Write a program that prompts the user to enter the number of copies to print, then calculates and prints the amount due.
Associated Concepts:
JOptionPane's input and output dialog boxes
Two-way selection structure
Nested selection structure
Two-way selection structure
Nested selection structure
Algorithm:
Declare variables to store data items.
Define constants to store constant values.
Read the number of copies using JOptionPane's input dialog box.
If the input is less than or equal to 0, print an error message.
Otherwise, proceed to calculate the cost.
If the number of copies is greater than 10, incorporate the additional copy's cost $7.25 in the formula.
Otherwise, use the base cost per copy $7.99 in the formula.
Print the result.
Define constants to store constant values.
Read the number of copies using JOptionPane's input dialog box.
If the input is less than or equal to 0, print an error message.
Otherwise, proceed to calculate the cost.
If the number of copies is greater than 10, incorporate the additional copy's cost $7.25 in the formula.
Otherwise, use the base cost per copy $7.99 in the formula.
Print the result.