Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Convert the following Java code into C++ This is what I have so far for C++. I'm not sure how to format printing in C++.
Convert the following Java code into C++
This is what I have so far for C++. I'm not sure how to format printing in C++. Please run your code and make sure it works.
1 import java.util.Scanner; 3 public class BillPay public static void main( String[] args )I Scanner input- new Scanner( System.in ); 6 7 PIZZA-PRICE= 10, BURGER_PRICE 7, SUSHIPRICE = 5, MOVIETICKET-PRICE = 12; final int 9 10 - - final double TIP PERCENTAGE0.15, 12 13 14 15 16 TAX RATE = 0.09; int numberOfPizzas - 0, numberOfBurgers = 0, numberOfSushis 0, numberOfMovieTickets = 0; 18 19 20 21 double restaurantBill- 0.0, movieTicketspriceBeforeTax 0.0 restaurantBillWithTip - 0.0, movieTicketsPriceWithTax = 0.0, totalExpense -0.0; 23 24 23 24 25 26 27 totalExpense .0; System.out.printf "Please input number of Pizzas to purchase: "); numberOfPizzas input.nextInt(); System.out.printf "Please input number of Burgers to purchase: "); numberOfBurgers - input.nextInt); System.out.printf "Please input number of Sushis to purchase: "); numberOfSushis input.nextInt); System.out.printf "Please input number of MovieTickets to purchase: "); numberOfMovieTickets - input.nextInt(); System.out.printf( "You will purchase: %d Pizzas %d Burgers Kd Sushis from the restaurant " , number0tPizzas, numberOfBurgers, number0fsushis ); restaurantBill PIZZA-PRICE * numberOfPizzas + BURGER-PRICE * numberOfBurgers + SUSHI-PRICE * numberOfSushis; System . out . printf( "The restaurant bill before tip is: $%.2fin", restaurantBill ): restaurantBillWithTip TIP PERCENTAGErestaurantBill + restaurantBill System.out.printf( "The restaurant bill with tip is: $%.2tinin", restaurantBillWithTip); System.out.printf( "The number of Movie Tickets to purchase is: %d ", number0fMovieTickets ); movieTicketsPriceBeforeTax-numberOfMovieTickets * MOVIE-TICKET-PRICE; System.out . printf( "The price of Movie Tickets before tax is: $%.2f ", movieTicket spriceBeforeTax ); movieTicketspriceWithTax = TAX-RATE * movieTicket spriceBeforeTax + movieTicketspriceBeforeTax; System.out . printf( "The price of Movie Tickets with tax is: $%.2f ", movieTicketsPriceWithTax ); tota!Expense = restaurantBillWithTlp + movieTicketsPriceWithTax; System.out.printf( "The total expense for the evening !s: $%.2fin", totalExpense ); 29 30 31 32 34 35 37 38 39 40 46 47 Console X sterminated> BankAccountTester lava Applicationl CProgram Files lavalire1,8.0 171binliavaw.exe (lan 24, 2019, 11:51:52 AM main.cpp Circle.cpp 1 billpay.cpp #include iostream #include iomanip> 3 using namespace std; 4int main(void) 6 7 8 9 10 int PIZZA PRICE-18, burgerprice-7,sushiprice-5,movieticketprice-12; float tipper .15,taxrate-.00; int numberofpizza, numberofburger, numberofsushi,numberofmovietickets; float resterauntbill,movieticketpricebeforetax,resterauntbillwithtip,movieticketpricewithtax,totalexpense; coutnumberofpizzaj coutc"Please input number of burgers to purchase: "; cin>>numberofburger cout>numberofsushi; coutc"Please input number of movietickets to purchase: "; cin>>numberofmovietickets; coutStep 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