Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I tried to get the same output as the exercise for two decimal places but it's giving me wrong everytime I try new input.i want
I tried to get the same output as the exercise for two decimal places but it's giving me wrong everytime I try new input.i want the same output as the exercise 2 decimal places for the price
exercise: Get a copy of format io.cpp. o If you download it, you might need to change the extension from .txt to .cpp o On Hercules you can get it with this cp command: cp et/data/ftp/pub/class/110/strings/format_io.txt readdata.cpp o Or you can use your mouse to copy and paste the program into your editor purpose of the program is to practice the getline and output formatting functions. - Examine the code and test the program with this input: Fluffy Puff Marshmallows 1.99 The output will be all wrong. Why is the product name only Fluffy? Why is the price wrong? Read the whole product name as one string. Format the price with discount so it always shows exactly two decimal places. Your final result should look like this: Product name: Fluffy Puff Marshmallows Price: $1.99 Fluffy Puff Marshmallows: $1.39 (with 30% discount) Try different inputs: Product name: Bubble Juice Price: $0.99 Bubble Juice: $0.69 (with 30% discount) Product name: PS5 Price: $499.99 PS5: $349.99 (with 30% discount Deliverables: o your commented C++ file o a demonstration of your results for all three inputs with three screen captures of the program run or a Here Gopyright: Department of Computer Science, University of Regina. Daring Port CD Run ain.cpp 3 B Problem Statement // Purpose: Practice reading lines of text and formatti number output 9 0 1 -2 13 // Complete this header based on the sample in Exercise // or match your professor's requirements. // Add short comments in the code to explain each change you make. 14 15 16 17 18 19 #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started