Question

Hey so i need help with this code.. For some reason it stops right after it askes for sales tax % Project! Microsoft Visual Studio Ouick Launch (Ctri+0) File Edit View Projcct Dabug Toam Tools Test Anayzc Window Hclp Aniudh Praksh Local Windows Debugger Scluticn Explcrer Pruject1 Glabal Sepie) #includedostream arch SnI.tinn Frplarer fCrrltà 4int main Project! iconstants for discaunt percentage const int ATLEAST18 1 const int A-LEAST28 ·20; const int ATLEASTR 9 External Dependencies Hrader Filcs Resource iles Source Files ubl diunt, totalenstafro, hillirgant Scurcepp cout << Enter the cost ot renting one room : cin rooncost ; cout < Nunber ot dsys the rons are booked tori innoonys Scluticn Fxplorer Team Explorer //Dİacuunt baaud un tíunbur uf ruana buukud discount ATLEAST28 Eror List Dreakpcirnts Output to Source C O Type here to search 6:11 10y28/2018

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Its working fine plz check now

Program:

// Example program
#include <iostream>
using namespace std;

int main()
{
const int ATLEAST10=10;
const int ATLEAST20=20;
const int ATLEAST30=30;
double roomcost,salestax;
int noofrooms,noofdays;
double discount=0,totalcostofrooms,billingamount;
cout<<"Enter the cost of renting one room $:";
cin>>roomcost;
cout<<"Enter no of rooms booked";
cin>>noofrooms;
cout<<"The no of days the rooms booked for";
cin>>noofdays;
cout<<"Enter sales tax:";
cin>>salestax;
if(noofrooms>=30)
{
discount=ATLEAST30;
}
else if(noofrooms>=20)
{
discount=ATLEAST20;
}
else
discount=ATLEAST10;
  
if(noofdays>=3)
discount+=5;
  
totalcostofrooms=(roomcost*noofrooms*noofdays)-((roomcost*noofrooms*noofdays*discount)/100);
billingamount=totalcostofrooms+((totalcostofrooms*salestax)/100);
cout<<"Cost of one room $"<<roomcost;
cout<<"\nDiscount on each room: $"<<discount;
cout<<"\nThe number of days rooms booked for:"<<noofdays;
cout<<"\nTotal cost of rooms: $"<<totalcostofrooms;
cout<<"\nSales tax applicable:"<<salestax;
cout<<"\nTotal billing amount: $"<<billingamount;
  
}

Output:

Enter the cost of renting one room $:100 Enter no of rooms booked15 The no of days the rooms booked fors Enter sales tax: 23 Cost of one room $100 Discount on each room: $15 The number of days rooms booked for:5 Total cost of rooms: $6375 Sales tax applicable:23 Total billing amount: $7841.25 Exit code: e (normal program termination)

Add a comment
Know the answer?
Add Answer to:
Hey so i need help with this code.. For some reason it stops right after it...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ; I'm having an issue editing the code. Could you please edit the code as the tutorial states and past the console o...

    ; I'm having an issue editing the code. Could you please edit the code as the tutorial states and past the console output. Here is the link. https://docs.microsoft.com/en-us/visualstudio/debugger/quickstart-debug-with-cplusplus?view=vs-2017 Exercise 1: Visual Studio Debugger https://docs.microsoft.com/en-us/visualstudio/debugger/quickstart-debug-with- cplusplus?view=vs-2017 Complete the tutorial. Include the console output of the sample console program after editing the code while debugging. The green Continue toolbar button can be used to continue executing code after pausing from a breakpoint. Instead of pressing F10, you can "Step Over" code using...

  • I need help solving this assignment, you are given a full piece of code that does not run correctly. Some of the bugs ca...

    I need help solving this assignment, you are given a full piece of code that does not run correctly. Some of the bugs can be found at compile time, while others are found at run time. Access the UserMenu.cpp code file (in the zip file in Start Here) and use debugging practices and the debugger in Visual Studio to find each bug. Fix the bug and write a comment in the code giving a description of how you found the...

  • What is wrong with my code? Why is it in infinite loop? this is the file...

    What is wrong with my code? Why is it in infinite loop? this is the file which it is reading, the code, and the infinite loop execution. Lab01-SalesReceipts-Microsoft Visual Studio File Edit View Project Build Debug Team Tools Test Analyze Window Help Debug x86 Local Windows Debugger - Lab01-SalesReceipts.cpp Lab01-SalesReceipts - (Global Scope) / Laben salesreceipts.cpp: Defines the entry point for the console application. 2 Samuel Gonzalez Checa R-include "5tda#x"h" include "1onanip 6 tinclude "iostrean include "fstream" 8 winclude "string...

  • The code will not run and I get the following errors in Visual Studio. Please fix the errors. err...

    The code will not run and I get the following errors in Visual Studio. Please fix the errors. error C2079: 'inputFile' uses undefined class 'std::basic_ifstream<char,std::char_traits<char>>' cpp(32): error C2228: left of '.open' must have class/struct/union (32): note: type is 'int' ): error C2065: 'cout': undeclared identifier error C2065: 'cout': undeclared identifier error C2079: 'girlInputFile' uses undefined class 'std::basic_ifstream<char,std::char_traits<char>>' error C2440: 'initializing': cannot convert from 'const char [68]' to 'int' note: There is no context in which this conversion is possible error...

  • I need help with this assignment, can someone HELP ? This is the assignment: Online shopping...

    I need help with this assignment, can someone HELP ? This is the assignment: Online shopping cart (continued) (C++) This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the ItemToPurchase class per the following specifications: Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt) Public member functions SetDescription() mutator & GetDescription() accessor (2 pts) PrintItemCost() - Outputs the item name followed by...

  • I need help finding the error in my code for my Fill in the Blank (Making a Player Class) in C++. Everything looks good...

    I need help finding the error in my code for my Fill in the Blank (Making a Player Class) in C++. Everything looks good to me but it will not run. Please help... due in 24 hr. Problem As you write in your code, be sure to use appropriate comments to describe your work. After you have finished, test the code by compiling it and running the program, then turn in your finished source code. Currently, there is a test...

  • Programming Concepts cin/cout variables/types Functions Reference structs Task Summary: For this first Quest you I have...

    Programming Concepts cin/cout variables/types Functions Reference structs Task Summary: For this first Quest you I have set up a program in Visual Studio that will use operation between fractions. I have written a basic code example that does all the resources that you need to follow. Your job is to complete the exercises presented below in quest2.cpp. For this assignment you will learn and demonstrate how to: Work with functions use Past-by-Value and Past-by-Reference. use structs. use cin to get...

  • I need help solving this in c++ using visual Studio. For this assignment, you will be filling in missing pieces of code within a program, follow the comments in the code. These comments will describe...

    I need help solving this in c++ using visual Studio. For this assignment, you will be filling in missing pieces of code within a program, follow the comments in the code. These comments will describe the missing portion. As you write in your code, be sure to use appropriate comments to describe your work. After you have finished, test the code by compiling it and running the program, then turn in your finished source code. // TicTacToe.cpp: Follow along with...

  • I need help figuring out how to code this in C++ in Visual Studio. Problem Statement:...

    I need help figuring out how to code this in C++ in Visual Studio. Problem Statement: Open the rule document for the game LCR Rules Dice Game. Develop the code, use commenting to describe your code and practice debugging if you run into errors. Submit source code. Use the document to write rules for the user on how to play the game in a text file. Then, using the information from the resource articles, create a program that will read...

  • Using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; u...

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; namespace FileWriter { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnCreate_Click(object sender, EventArgs e) { try { //write code that assigns the value in the textbox to an Integer variable if // write code that validates whether or not the data entered in the textbox is greater than or equal to 1 *...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT