Question

Much to the governments dismay, people in the U.S. prefer paper money to coins. The U.S. Treasury has spent considerable tim

What You Need To Do Make sure that your program: Reads four values (four integers - twenties, tens, fives, ones). You may ass

Help with c please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PLEASE NOTE : FEEL FREE TO ASK ANY DOUBTS by COMMENTING

  • If you want me to add/change anything, Please let me know by commenting.
  • I used comments for better understanding. Commenst starts with '//'
  • Please refer to the screenshot of the code to understand the indentation of the code

Language : C Programming

IDE : Dev C++

:::::::::::::::::::::::::::::::::::::::::::: CODE ::::::::::::::::::::::::::::::::::::::::

#include <stdio.h>
int main(){
   // declare required variables
   int twenties,tens,fives,ones;
   int total;
   double height;
   double weight;

   // read 4 integers from input
   printf("Enter the number of $20s you have: ");
   scanf(" %d",&twenties);

   printf("Enter the number of $10s you have: ");
   scanf(" %d",&tens);

   printf("Enter the number of $5s you have: ");
   scanf(" %d",&fives);

   printf("Enter the number of $1s you have: ");
   scanf(" %d",&ones);

   // calculate total coins
   total = twenties*20+tens*10+fives*5+ones;

   // calculate height by inches
   height = (total*2)/25.4;

   // calculate weight by pounds
   weight = (total*8.1)/453.592;

   // print total coins
   printf("You have $%d in total cash\n",total);

   // print height and weight by two decimal point
   printf("Your stack of coins is %.2lf inches high.\n",height);
   printf("Your stack of coins weighs %.2lf pounds.",weight);

   return 0;
}

:::::::::::::::::::::::::::::::::::::::::::: OUTPUT ::::::::::::::::::::::::::::::::::::::::

j E:\coins.exe Enter the number of $20s you have: 3 Enter the number of $10s you have: 2 Enter the number of $5s you have: 1

:::::::::::::::::::::::::::::::::::::: CODE in EDITOR ::::::::::::::::::::::::::::::::::

coins.c OOO OU AWNA 18 NNNPPPPPPP WNNNNNNNN JOWNHO #include <stdio.h> 29 int main(){ // declare required variables int twenti

_________________________________________________________________

Dear Friend, Feel Free to Ask Any Doubts by Commenting. ASAP i'll respond when i'm available.

I'm on a critical Situation. Please Do Not Forget To Give A Thumbs UP +1. It will Helps me A Lot.

Thank YOU :-)

Add a comment
Know the answer?
Add Answer to:
Help with c please Much to the government's dismay, people in the U.S. prefer paper money...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Money Lab using arraylists in Java Using the Coin class below create a program with the...

    Money Lab using arraylists in Java Using the Coin class below create a program with the following requirements Create an arraylist that holds the money you have in your wallet. You will add a variety of coins(coin class) and bills (ones, fives, tens *also using the coin class) to your wallet arraylist. Program must include a loop that asks you to purchase items using the coins in your wallet. When purchasing items, the program will remove coins from the arraylist...

  • in C please! Proiect Overview: A business owner is unhappy with the services provided by the...

    in C please! Proiect Overview: A business owner is unhappy with the services provided by the government and has chosen to pay the tax using a combination of coins including quarters, dimes, nickels, and pennies. In this project, you are asked to write a program to analyze the tax payment in coins. Th nickels and pennies the owner has paid. It then computes the total amount of tax paid in dollars and cents, and computes the weight of all the...

  • You work at a bank and needs to automate the bills that are given to a...

    You work at a bank and needs to automate the bills that are given to a customer when they cash a check. When the check is cashed, the system should automatically break down the dollar amount into the smallest number of $20, $10, $5, and $1 bills. Specifications: Write a program that prompts the user to enter a U.S dollar amount and then shows how to pay the customer using the smallest number of bills. After the program runs, prompt...

  • I am stumped on a piece of code in Java. We are making a coin counter...

    I am stumped on a piece of code in Java. We are making a coin counter like one of those kiosks but it has to be formatted properly. For example, if it asked me to put in my coins, it wants it as: penny for 1 penny pennies for more than 1 penny otherwise it must display "invalid input" if we input 3 penny instead of 3 pennies then the final output after everything is set up solved , it...

  • In C++ Consider a cash register that uses an automated machine. For the “paper money inserted”,...

    In C++ Consider a cash register that uses an automated machine. For the “paper money inserted”, and the “amount of purchase”, the machine returns “paper money and coins”. Write a program that gets from user the following “paper money inserted” and the “amount of purchase”, and display the output as: Purchase 3.08 Payment 10.00 Change 6.92 Dollars 6 Quarters 3 Dimes 1 Nickels 1 Pennies 2 Hint: - to get “dollars” and “coins” use : static_cast &lt; int &gt; -...

  • it c++ coding. please write on atom software. 1. Write a program that converts dollars into coins a. Request a dolla...

    it c++ coding. please write on atom software. 1. Write a program that converts dollars into coins a. Request a dollar amount as an integer: $5.34 is input as 534 b. Use a constant variable to represent each coin as a fixed value: const int NICKEL 5; c. Use division and the mod function to calculate the number of each coin. Change Calculator Enter dollar amount (as an integer): $534 The equivalent in coins: 21 Quarters 0 Dimes 1 Nickels...

  • Question2 uses structured design implemented in C. Array of records (structs) with file I/O is needed....

    Question2 uses structured design implemented in C. Array of records (structs) with file I/O is needed. The program takes two inputs at a time. The name of a person, and, the coin value as an integer in the range 5 to 95. Input coin values should always be divisible by 5 (integer division). Names are one word strings. An example input is: Jane 30 This input line indicates that 30 cents change is to be given to Jane. Output change...

  • Problem: Implement (in C) the dynamic program algorithm for the coin-change algorithm, discussed in class. Assume...

    Problem: Implement (in C) the dynamic program algorithm for the coin-change algorithm, discussed in class. Assume that the coins with which you make change are quarters, dimes, nickels and pennies. Thus you are going to set n = 4 in your program. The amount k for which you have to make change will be provided by the user and your program will return the minimum number of coins needed and also the break-up of the change in terms of the...

  • C++ HW Question Your program will simulate a simple change maker for a vending machine. It...

    C++ HW Question Your program will simulate a simple change maker for a vending machine. It will start with a stock of coins and dollars. It will then repeatedly request the price for an item to be purchased or to quit. If given a price, it will accept nickels, dimes, quarters, one-dollar and five-dollar bills—deposited one at a time—in payment. When the user has deposited enough to cover the cost of the item, the program will calculate the coins to...

  • PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program tha...

    PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file  timeValidation.txt :   ...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT