Write cout statements with stream manipulators that perform the following:
A) Display the number 34.789 in a field of nine spaces with two decimal places of precision.
B) Display the number 7.0 in a field of five spaces with three decimal places of precision.
The decimal point and any trailing zeros should be displayed.
C) Display the number 5.789e+12 in fixed-point notation.
D) Display the number 67 left-justified in a field of seven spaces.
Learn your wayIncludes step-by-step video
Chapter 3 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Electric Circuits. (11th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Introduction To Programming Using Visual Basic (11th Edition)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Starting Out With Visual Basic (8th Edition)
- Write C code that calculates and prints the volumes of different shapes (Sphere and Frustum ). The program asks the user to read a character (ch). Every time ch is entered, the program does the following: - if ch is 's', then the program asks the user to enter a float (d) and prints the volume of the sphere. vol. Sphere - if ch is 'f', then the program asks the user to enter three floats (h, b ,and d) and prints the volume of the frustum. vol. Frustum -- Notes: - consider straight pi space equals space 3.14 - entered characters are case insensitive ( example: to quit you can enter q or Q) - entered floats should be strictly positive (zeros and negatives are not acceptable, and the user should be informed with a message (invalid number)). - if the user enters a value of ch other than the one specified, the program should print (invalid choice)arrow_forwardWrite C code that calculates and prints the volumes of different shapes (Sphere and Frustum ). The program asks the user to read a character (ch). Every time ch is entered, the program does the following: - if ch is 's', then the program asks the user to enter a float (d) and prints the volume of the sphere. V = Id3 6. - if ch is 'f', then the program asks the user to enter three floats (h, b ,and d) and prints the volume of the frustum. V = IT h 12 Vdb +arrow_forward8°C Sunny Write a program called p4.py that asks the user for two integers representing the month [1,..., 12] and the day [1.. 31] respectively. Your program should then output, which of the four seasons ("Winter", "Spring", "Summer", or "Fall") the entered date is in. ..... You should use the following date ranges for each season: 1. Spring: March 20th to June 20th 2. Summer: June 21st to September 22nd 3. Fall: September 23rd to December 20th 4. Winter: December 21st to March 19th Hint: You can use logical operators ‘and' / 'or' to combine multiple Boolean expressions. Example: Enter month [1,12]: Enter day [1,31]: 19 It's Winter! Enter month [1,12]: 3 Enter day [1,31]: 21 ENG USarrow_forward
- SU-SARW MORELO nir, à yliviA. ( (F 2) Activity 3: Skill-building Activities (with answer key) (18 mins + 2 mins checking) evsri NoWrite a pseudocode for the real percentage-to-numerical-grade-equivalent displaying. Only one bris berlailgrno008 terpercentage score can be entered at a time. The grading scale is as follows: Grading Scale: Numerical Percentage value 5.00-0 to 59.9;arrow_forward1- Develop a C code that gets three numbers from the user and : Calculates and displays the largest of the three Calculates and displays the smallest of the three If the average is equal the middle number, displays "balanced triple!" otherwise displays "imbalanced triple!"arrow_forwardProgram: Food receipt Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) (1) Prompt the user to input a food item name, price, and quantity. Output an itemized receipt. (Submit for 2 points) Enter food item name: hot dog Enter item price: 2.00 Enter item quantity: 5 RECEIPT 5 hot dog @ $2.00 = $10.00 Total cost: $10.00 (2) Extend the program to prompt the user for a second item. Output an itemized receipt. (Submit for 2 points, so 4 points total) (3) Extend again to output a third receipt that adds a mandatory 15% gratuity to the total cost. Output the total cost, the cost of gratuity, and the grand total. (Submit for 3 points, so 7 points total)arrow_forward
- 2. Create a function that will input 10 numbers and will perform the following 1. Display all even numbers 2. Display all the numbers 3. Display all odd numbers 4. Exitarrow_forward2- Write a pyhton function that prompts the user to input three integers and prints the sum of those numbers.arrow_forward(Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,