Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 5 Weeks Ago, 3 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Please I have Java programming questions:
JAVA HOMEWORK-1
Write a program to calculate the area of a circle ( 3.1425*r*r ). The program will output the area of the circle based on a radius value initialized in the program.
Â
JAVA HOMEWORK-2
Write a program that reads an integer value between 0 and 100 (inclusive), representing the amount of a purchase in cents. Produce an error message if the input value is not in range. If the input is valid, determine the amount of change that would be received from one dollar, and print the number of quarters, dimes, nickels, and pennies that should be returned. Maximize the coins with the highest value.
Follow the format below.
Enter the purchase amount [0-100 ]: 36
OUTPUT:
Your change of 64 cents is given as:
2 Quarters
1 Dimes
0 Nickels
4 Pennies
Â
HINT: 64 / 25 equals 2, and 64 % 25 equals 14
Â
Use the following lines of code to read an integer from the user. The Scanner object will be used.
Don't forget to import the java.util.Scanner package.
Â
import java.util.Scanner;
Â
public static void main(String[] args) {
Â
// Declare a data type Scanner
Â
int number;
Scanner scan = new Scanner (System.in);
Â
System.out.println("Input a number: ");
number = scan.nextInt();
Â
// .....program logic goes here .....
Â
} // end main
Â
Â
Â
Thank you
Attachments:-----------