Question

Hello Sorry but I'm stuck in this lab. LAB - Dollar Bills Distributed: week3, Lab Session...

Hello Sorry but I'm stuck in this lab.

LAB - Dollar Bills
Distributed: week3, Lab Session A Due: week3, Friday 11:59pm (late date is Sunday)

PROGRAM DESCRIPTION

User will input a whole number between 1 and 10, and the program will output that number as a dollar value. For example, if the user enters the number 4, the program will output the associated real value as currency: $ 4.00.

Your program should prompt the user to enter in a number between 1 and 10. Your program then prints out the associated value as dollars and zero cents, in the format above.

For this lab, it is not necessary that you check to see if the number the user entered in is between 1 and 10.

You will need to include the following lines of code to format your output:
   cout.setf(ios::fixed);

   cout.setf(ios::showpoint);

cout.precision(2);


EXAMPLE RUN (no indentation or tab):
Please enter the number of dollar bills in your wallet: 4 You have $ 4.00

NOTES:

• The text of your program needs to appear exactly as that above (minus the color)

• The first line is called the user prompt, and ends with a colon

• The number in yellow is the INPUT, and is what the user enters (between 1-10)

• The second line is the OUTPUT, with the formatted output created by your program, preceeded by a label (exactly as above)

• THE ONLY VARIABILITY IS THE VALUE ENTERED (yellow), AND ITS ASSOCIATED OUTPUT (green)

• Tip: Your output will need to include a carriage return after each output line, with a blank line both preceeding and succeeding your output. You can accomplish this with "\n" or endl.

DELIVERABLES SUMMARY (10pts)

• Your lab3.cpp submission at https://turnin.ecst.csuchico.edu which compiles successfully and passes the comparison tests to expected output. Your source file must include a complete general header & inline comments.

• A companion submission to Blackboard:

   o your lab3.cpp file

   o screenshot which reflects turnin success & jaguar command-line compilation and practice runs (see posted example)

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

SOURCE CODE IN C++:

#include <iostream>

using namespace std;

int main()

{

//declaring variable for user input

int num;

//input prompt

cout << "Please enter the number of dollar bills in your wallet: ";

cin >> num; //input

//output

cout.setf(ios::fixed);

cout.setf(ios::showpoint);

cout.precision(2);

cout << "You have $ " << (double)num << endl;

return 0;

}

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Hello Sorry but I'm stuck in this lab. LAB - Dollar Bills Distributed: week3, Lab Session...
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
  • This application is for you, the shopper in mind. Putting together an itemized shopping list that...

    This application is for you, the shopper in mind. Putting together an itemized shopping list that contains the items you need, the items you want, and the anticipated cost, this program will generate a total price. This way you can decide if your shopping budget fits the bill. Example list: Price List Binder paper: 2.29 Mop: 7.50 Scouring pads: 5 Your application program will create and write a new list to an output file in which the need and wish...

  • Lab #7 CSE110 - Arizona State University Topics • Basic arrays Coding Guidelines • Give identifiers...

    Lab #7 CSE110 - Arizona State University Topics • Basic arrays Coding Guidelines • Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc). • Keep identifiers to a reasonably short length. • Use upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables, methods, objects). • Use tabs or spaces to indent code within blocks (code surrounded by braces)....

  • In C++ please! Please include .cpp and .hpp files! Thank you! Recursive Functions Goals Create and...

    In C++ please! Please include .cpp and .hpp files! Thank you! Recursive Functions Goals Create and use recursive functions In this lab, we will write a program that uses three recursive functions. Requirements: Important: You must use the array for this lab, no vectors allowed. First Recursive Function Write a function that recursively prints a string in reverse. The function has ONLY one parameter of type string. It prints the reversed character to the screen followed by a newline character....

  • In C only Please! This lab is to write a program that will sort an array...

    In C only Please! This lab is to write a program that will sort an array of structs. Use the functions.h header file with your program. Create a source file named functions.c with the following: A sorting function named sortArray. It takes an array of MyStruct's and the length of that array. It returns nothing. You can use any of the sorting algorithms, you would like though it is recommended that you use bubble sort, insertion sort, or selection sort...

  • ZYBOOKS LAB: 10.23.1 Hello, I'm trying to solve this problem with creating a program code in...

    ZYBOOKS LAB: 10.23.1 Hello, I'm trying to solve this problem with creating a program code in Python about People's Weights. Here is the question: 10.23 LAB: Warm up: People's weights (Lists) (1) Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store all weights in a list. Output the list. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 176.0 Enter weight 4: 166.3 Weights: [236.0, 89.5, 176.0, 166.3]...

  • C++ Please Follow Instructions Write a program that displays an inches to centimeters conversion table. Your...

    C++ Please Follow Instructions Write a program that displays an inches to centimeters conversion table. Your input will be the smallest number of inches and the largest number of inches to be converted. The intervals will be in 6 inch increments. One inch is equivalent to 2.54 centimeters. Include the following in your program: 1. Include an initial algorithm that outlines your steps. 2. Include a refined algorithm that details how each step will be executed. 3. Prompt the User...

  • CSCI 161 - Lab 2: "Give Me a Second!" Overview This lab will have you developing...

    CSCI 161 - Lab 2: "Give Me a Second!" Overview This lab will have you developing a program that asks the user to input a time period as a number of seconds and in turn calculates the whole number of days, hours and minutes that are contained within the entered time period. Refer to the "Output Format" below for an example of what your program must do. The objectives of this lab are to reinforce and help teach: proper Java...

  • Hey, i'm super stuck on my lab in cs102. I have attempted it but never got...

    Hey, i'm super stuck on my lab in cs102. I have attempted it but never got close to what the end result should be. Please help, due in 2 days!! Assignment You will be writing a program to simulate a slot machine. The player will start with $1000 and you will repeatedly ask the user how much money they wish to insert into the machine before spinning, or allow the player to quit. If the player runs out of money,...

  • NOTE: Write the Program in python as mentioned below and use while loop and flags as...

    NOTE: Write the Program in python as mentioned below and use while loop and flags as necessary. And please write the code following the program description given below. Directions: Read the program description below carefully. All requirements must be met by your program to receive full credit. Thus, pay particular attention to input and output requirements, structural requirements, and so on. Furthermore, code that contains syntax errors will not receive any credit, so be sure that your code interprets correctly...

  • For this lab, you can assume that no string entered by the user will be longer...

    For this lab, you can assume that no string entered by the user will be longer than 128 characters. You can also assume that the database file does not contain more than 128 lines. However, you can not assume that the database has the correct format. There are three commands your program must handle. If any other command is entered, the program should reply Unrecognized command. and then present the prompt again. The three commands are: quit - The program...

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