Write a Java program to calculate the fee for photo-coping document. The program will read an integer number from the keyboard which is the number of photocopies to be produced. The program will also calculate the fee as follow:
- if the number of copies is less than 100, each copy costs $0.10
- if the number of copies is between 100 and 499 (inclusive), each copy costs $0.05
- if the number of copies is between 500 and 999 (inclusive), each copy costs $0.03
- if the number of copies is 1000 and above, each copy costs $0.01
Finally, the program will print the fee.
![1 import java.util.*; 2 public class Calculate f 3 public static void main(String[] args) 4 /*Creating a Scanner object to ge](http://img.homeworklib.com/questions/ba740cf0-3ce2-11eb-9677-f73eb2bfe613.png?x-oss-process=image/resize,w_560)
Code (Text Format):
import java.util.*;
public class Calculate {
public static void main(String[] args){
/*Creating a Scanner object to get
input from console*/
Scanner sc = new Scanner(System.in);
System.out.print("Enter the number
of photocopies: ");
/*Taking number of photocopies as
input*/
int num = sc.nextInt();
double cost;
/*Defining if else statements according to the
conditions
given in question*/
if(num<100)
cost = num * 0.10;
else if(num>=100 && num<=499)
cost = num * 0.05;
else if(num>=500 && num<=999)
cost = num * 0.03;
else
cost = num * 0.01;
System.out.println("Cost = $"+cost);
/*Its a good practice to close Scanner to avoid
leaks*/
sc.close();
}
}
Sample Outputs:




Please give feedback.
Write a Java program to calculate the fee for photo-coping document. The program will read an...
Using Java, write a program that teachers can use to enter and calculate grades of individual students by utilizing an array, Scanner object, casting, and the print method. First, let the user choose the size for the integer array by using a Scanner object. The integer array will hold individual assignment grades of a fictional student. Next, use a loop to populate the integer array with individual grades. Make sure each individual grade entered by the user fills just one...
Write a java class that obtains an integer value from a customer that represents the number of photocopies to be printed. Then, calculate and display the total job cost. Your "if" test will determine whether or not there are more than 50 copies involved. You will need to use the DecimalFormat class to obtain the proper number of decimal places shown in the output sample. Review Notes 3. Base your calculations on these rates: the cost for up to and...
32) Write a valid Java statement that generates a random value between 1 and 100, inclusive, and assigns that value to randPer. 33) What library must be imported to use the Java random number generator class and its methods? Give the correct import statement needed to ensure that this class is available for use in the program using it. 34) Write a valid method in Java that performs a simulated coin-toss – meaning it returns boolean value of either true...
1. write a java program using trees(binary search treee) to read integers from input file( .txt) and add +1 to each number that you read from the input file. then copy result to another (.txt) file. example: if inpu File has numbers like 4787 79434 4326576 65997 4354 the output file must have result of 4788 79435 4326577 65998 4355 Note: there is no commas in between the numbers. dont give images or theory please.
Write a Java program with a single-dimension array that holds 11 integer numbers and sort the array using a bubble sort. Next, identify the median value of the 11 integers. Here are the steps your program must accomplish. algorithm (either flowchart or pseudocode) that you will use to write the program Step 1. Create an Place the algorithm in a Word document. 6. Ste the Step 2. Code the program in Eclipse and ensure the following steps are accomplished. 1....
Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...
Write a program in either C++ or Java meeting these requirements Description: In this program, we assume that our data comes in dynamically. We need to maintain our data in a heap, after every insertion and deletion. We also need to handle the underlying array dynamically. whenever we detect an overflow in our array, we will create a new array with size doubling the previous size. Requirements: 1. (Dynamic Data) when we generate the data, we simulate dynamic data. We...
What to submit: your answers to exercises 2. Write a Java program to perform the following tasks: The program should ask the user for the name of an input file and the name of an output file. It should then open the input file as a text file (if the input file does not exist it should throw an exception) and read the contents line by line. It should also open the output file as a text file and write...
PLEASE DO THIS IN JAVA!Design (pseudocode) and implement (source code) a program (name it PhoneBill) that calculates the bill for a cellular telephone company. The company offers two types of service: regular service and premium service. The rates vary depending on the type of service. The rates are computed as follows: Regular service: $15.00 fee covering first 50 minutes. Charges for over 50 minutes are computed at the rate of $0.50 per minute. Premium service: $25.00 fee plus: a. For...
IN JAVA PLEASE Design (pseudocode) and implement (source code) a program (name it PhoneBill) that calculates the bill for a cellular telephone company. The company offers two types of service: regular service and premium service. The rates vary depending on the type of service. The rates are computed as follows: Regular service: $15.00 fee covering first 50 minutes. Charges for over 50 minutes are computed at the rate of $0.50 per minute. Premium service: $25.00 fee plus: a. For daytime...