Question

Create a function called totalCoins that takes an integer price of a product (in pennies) and an integer amount of money paid (in pennies). It should return via output parameters the number of dollars, quarters, dimes, nickels, and pennies given as change. Must use pointers. C programming

Answer #1

C Code:

```
#include<stdio.h>
//definition for totalCoins()
void totalCoins(int price, int amount)
{
//variables declaration
int change , dollors , quarters , dimes , nickels , pennies;
//change is the amount to be returned as change
change = amount - price;
dollors=change/100; //calculating dollors from change
//if dollor is valid or more than 0 than update remaining change value
if(dollors>=1)
change=change-dollors*100;
quarters=change/25; //calculating quarters from change
//if quarters is valid or more than 0 than update remaining change value
if(quarters>=1)
change=change-quarters*25;
dimes=change/10; //calculating dimes from change
//if dimes is valid or more than 0 than update remaining change value
if(dimes>=1)
change=change-dimes*10;
nickels=change/5; //calculating nickels from change
//if nickels is valid or more than 0 than update remaining change value
if(nickels>=1)
change=change-nickels*5;
//printing output...
printf("\nChange=>\nDollors: %d\nQuarters: %d\nDimes: %d\nnickels: %d\nPennies: %d",dollors,quarters,dimes,nickels,change);
}
//main
int main()
{
//variable declaration
int price , amount;
//taking inputs
printf("Enter price and amount: ");
scanf("%d%d",&price,&amount);
//function call
totalCoins(price ,amount);
return 0;
}
```

Output:

Create a Change application that prompts the user for an amount
less than $1.00 and then displays the minimum number of coins
necessary to make the change. The change can be made up of
quarters, dimes, nickels, and pennies. The application output
should look similar to:
Enter the change in cents: 212
The minimum number of coins is:
Quarters: 8
Dimes: 1
Nickels 0
Pennies: 2
Must be coded in Java please

4) Create the following in a Java program.
Create a Scanner
Prompt the user to Receive the amount and declare the variable
double amount for scanner
Declare variable integer remaining amount which is equal to (int)
(amount*100)
Find the number of one dollars bt declaring the integer variable
which is equal to remaining amount divided by 100
Declare: remaining amount %=100
Find the number of quarters:
Declare integer variable number of quarters equal to remaining
amount divided by 25
Declare:...

You have a large collection of pennies and wish to change them
into dollar bills at the bank, with quarters, dimes, nickels, and
pennies being used for any remainder. Prompt for the number of
pennies and produce output as shown below.
Write the pseudo code
Desk check
Modify if necassary
Code
Compare output
Output:
How many pennies do you have (must be greater than 100)? [Assume
user inputs 641]
641 pennies can be changed at the bank as follows:
Dollars:...

Write a program that reads three integer values from the
keyboard using the Scanner class representing, respectively, a
number of quarters, dimes, and nickels. Convert the total coin
amount to dollars and output the result.Write a program that reads
three integer values from the keyboard using the Scanner class
representing, respectively, a number of quarters, dimes, and
nickels. Convert the total coin amount to dollars and output the
result.

USE PYTHON Please!!!
4.15 LAB: Exact change
Write a program with total change amount as an integer input,
and output the change using the fewest coins, one coin type per
line. The coin types are Dollars, Quarters, Dimes, Nickels, and
Pennies. Use singular and plural coin names as appropriate, like 1
Penny vs. 2 Pennies.
Ex: If the input is:
0
(or less than 0), the output is:
No change
Ex: If the input is:
45
the output is:
1...

Write a program that reads three integer values from the
keyboard using the Scanner class representing,
respectively, a number of quarters, dimes, and nickels.
Convert the total coin amount to dollars and
output the result.

Design a Candy Machine which takes Quarters, Dimes and Nickels
for releasing a Candy which costs 40 cents. • Input: Q(Quarter),
D(Dime),N(Nickel) • Output: Candy released
Notation: • Q=Quarters • D=Dimes • N=Nickels
Required Output: Candy should be coming out of the machine after
receiving an amount greater than or equal to 40 cents.
make a state table and a state diagram for this question
Extra Credit: Extra credit will be given if you also return
change along with candy

CREATE USING A STATE DIAGRAM
Design a Candy Machine which takes Quarters, Dimes and Nickels
for releasing a Candy which costs 40 cents and returns change.
• Input: Q(Quarter), D(Dime),N(Nickel)
• Output: Candy released
Candy should be coming out of the machine after receiving an
amount greater than or equal to 40 cents.

Using C programming
Create a function called printMenu( ) with the following
properties:
Has no function inputs or output.
Prints the following menu to the screen:
1. Enter user name.
2. Enter scores.
3. Display average score.
4. Display summary.
5. Quit
Create a function called printLine( ) with the following
properties:
Takes as input a char
Takes as input an integer corresponding to the number of
times to print the character
Has no function output.
For example, if we...

program has to be written in X86 processor assy language.
Write a program that find the minimum number of coins that can
represent an amount of money under $1.
The amount of money is a random number between 0 and 99
(cents).
The randomRange procedure is used to get a random number.
Review the sample code in lab4.asm and run it to see how
randomRange works. Each time
randomRange is called, it creates a
random number between 0 and the...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 1 minute ago

asked 3 minutes ago

asked 3 minutes ago

asked 10 minutes ago

asked 10 minutes ago

asked 11 minutes ago

asked 28 minutes ago

asked 30 minutes ago

asked 30 minutes ago

asked 45 minutes ago

asked 45 minutes ago

asked 1 hour ago