Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This was written in C++ I need help trying to get a calculator running.I'm going to try my best to explain it. So each pizza

This was written in C++

I need help trying to get a calculator running.I'm going to try my best to explain it. So each pizza box has 12 slices in it.(In this assignment) My problem is that I cant find a way to make my code understand that every pizza box is equal to 12 slices. So for example, if I have 6 guests and according to my code. Each of them will eat 3 slices. So, my code has to show that I will need to order 2 boxes of pizza not 1 and a half, which is why i rounded it so it can lean towards the higher number.

#include #include

int main() { double taxes; double subtotal; double subtotaltax; double pizzacosts; double numberofpizzasneeded; double totalwithtaxes; double pizza; int people; int SlicesPP;

pizzacosts = 12.95; SlicesPP = 3; taxes = 0.0825;

std::cout << "******************** "; std::cout << "* PIZZA CALCULATOR * "; std::cout << "******************** ";

std::cout << " How many people will be eating pizza today? "; std::cin >> people;

pizza = (people * SlicesPP) / 3; numberofpizzasneeded = round(pizza); subtotal = pizzacosts * pizza; totalwithtaxes = (subtotal * taxes) + subtotal; std::cout << "The number of pizzas needed: " << numberofpizzasneeded << " "; std::cout << "Subtotal: " <

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions