Question
Declare the following variables in the main method: int quarters; // this variable which holds the number of the quarters int dimes; // this variable
Declare
the following variables in the main method:
int quarters; // this variable which holds the number of the quarters int dimes; // this variable holds the number of the dimes int nickels; //this variable holds the number of the nickels, int pennies;// this variable holds the number of pennies
int totalPennies int totalDollars int totalDimes int totalnickels
Call the following method in the main method: calculatePennies
caculatedollar calculateQuarter caculateNikels caculateDimes input output
Add the following methods in the class that you are creating:
Write a method called calculatePennies. This method accepts the number of the quarters, dimes nickels and dimes as its parameter and returns the total amount of the money in pennies.
Write a method named calculateDollar. This method accepts the number of the total amount of the pennies and returns the amount in dollars.
Write a method called calculateQuarter. This method accepts the total amount of the pennies and returns the amount of the money in quarters.
Write a method called calculateNikels. This method accepts the number of the amount of pennies as its parameter and returns the amount of the money in nickels.
Write a method called calculateDimes. This method accepts the total amount of pennies as its parameter and returns the amount of the money in dimes.
Write a method called input. This method accepts the number of the quarters, dimes nickels and dimes as its parameter and outputs the number of the coins on the screen.
Write a method called output. This method accepts the total money in dollar, total money in quarter, total money in dimes, total money in nickels and out puts the result on the screen
Write a program that calculates the total amount of the money that a person has in quarters, dimes, nickels and pennies. You must create all the required methods.
Here is a sample output:
you have : 12 quarters
20 dimes
30 Nickels
150 pennies
The amount of your money in dollar is : 8 The amount of your money in quarter is :32 The amount of your money in dime is : 80 The amount of your money in nickel is :160 The amount of your money in penny is : 800
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started