Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having issues with this in C++. I need the totals to be rounded to two decimal places but can't figure out how to make

I'm having issues with this in C++. I need the totals to be rounded to two decimal places but can't figure out how to make it. if anyone can help I would really appreciate it!!

I attached a photo of the output of the code for better clarification.

******************************************

#include using namespace std; struct menuItemType { float price=0; int orderNumber; }; //Defining array menuList[] of type menuItemType menuItemType menuList[8]; class Resturant{ public: int i=0; void getData(){ char choice; int iNumber; cout>choice; while(choice=='y'||choice=='Y') { cout>iNumber; menuList[i].orderNumber=iNumber; switch(iNumber){ case 1: menuList[i].price=1.45; break; case 2: menuList[i].price=2.45; break; case 3: menuList[i].price=0.99; break; case 4: menuList[i].price=1.99; break; case 5: menuList[i].price=2.49; break; case 6: menuList[i].price=0.69; break; case 7: menuList[i].price=0.5; break; case 8: menuList[i].price=0.75; break; default: cout>choice; i++; } } void showMenu(){ cout

image text in transcribed

x + >_ Terminal + Welcome to Johnny's Resturant A-Z ... - Today's Menu-.. 1: Plain Egg $1.45 2: Bacon and Egg $2.45 3: Muffin $0.99 4: French Toast $1.99 5: Fruit Basket $2.49 6: Cereal $0.69 7: Coffee $0.50 8: Tea $0.75

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions