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
C Programming Language
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
C++ How to Program (10th Edition)
Starting Out with Python (4th Edition)
Artificial Intelligence: A Modern Approach
Starting Out with Java: Early Objects (6th Edition)
- Apps M Gmail YouTube Maps < Every Write a complete C++ program that: 1) Prompts the user to enter from the keyboard two numbers of type float and store them in the variables xand y. 2) Calculates the value off as follows: x² + y² f%=D x - y 3) At the beginning of a new line, displays the entered values of xand y. Each is located in a field of 10 positions with 2 digits to the right of the point. The unused positions in the fields MUST be filled with '&'. The values are separated by a tab. 4) Displays the value of f at the beginning of the next line in a field of 10 positions with 3 digits to the right of the point. The unused positions in the fields MUST be filled with %'. You program MUST display the results exactly as shown in the sample runs below. Say some CSC 103 Lab Quiz 1 SECT18.pdfarrow_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. 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_forward) /₹3soos alspaarrow_forward
- 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. 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_forwardWrite code that performs the following input operations: Read an int from the keyboard and assign it to a variable named k . (Do not print a prompt. Use the input() function without a prompt-string to read the input.) Read a float from the keyboard and assign it to a variable named d . (Do not print a prompt. Use the input() function without a prompt-string to read the input.) Read a string from the keyboard and assign it to a variable named s . (Do not print a prompt. Use the input() function without a prompt-string to read the input.) After you have performed the input, on one line, print these variables in reverse order ( s followed by d , followed by k ) with exactly one space in between each. On a second line, print them in the original order ( k followed by d , followed by s ) with one space in between them.arrow_forward
- Please do not refuse my homework :) It is very important to me. Homework will be solved with visual studio c# program. Write a program that has the followings:1) A text will be entered by the user.2) After getting the text, the followings will be displayed: First occurence order of each character will be displayed under “Occurence order” title.Character will be displayed under “Character” title.How many times the character is used in the text will be displayed under “Amount of occurence” title. (In short, it will be like the black output screen in the picture)3)At page 2, the flowchart of the solution key of this homework is attached. It is not obligatory but you can use the algorithm used in the flowchart.arrow_forwardx = 9 ; y = x++ What are the values of x and y after the two statements execute? X = y =arrow_forwardSU-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_forward
- 1- 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_forward15. Speed Conversion ChartYour friend Amanda, who lives in the United States, just bought an antique European sports car. The car’s speedometer works in kilometers per hour. The formulafor converting kilometers per hour to miles per hour is:MPH = KPH * 0.6214In the formula, MPH is the speed in miles per hour and KPH is the speed in kilometersper hour. Amanda is afraid she will get a speeding ticket, and has asked you to write aprogram that displays a list of speeds in kilometers per hour with their values convertedto miles per hour. The list should display the speeds from 60 kilometers per hourthrough 130 kilometers per hour, in increments of 5 kilometers per hour. (In otherwords, it should display 60 kph, 65 kph, 70 kph, and so forth, up through 130 kph.) made in visual studio 2017arrow_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,