Query

Write your question here.

Hello my ICT lab project program is difficult so please solve this program and send me source code.

Develop a billing system for a Guest House which offers lodging at following rates:
• Economy Single Bed: Rs. 3,000/Day
• Economy Two Bed: Rs. 5,000/Day
• Luxury Single Bed: Rs. 6,000/Day
• Luxury Two Bed: Rs. 10,000/Day
The guest house offers following discounts on Economy-Rooms customers ONLY if duration of stay is at least 2 or more days.
• If payable amount is more than 12000, he gets a 12% discount
• If payable amount is more than 8000, he gets a 10% discount
• If payable amount is more than 4000, he gets a 8% discount
Write a C++ program that asks Room Type and Duration of stay from the user and generates billing details as under:
• Rate of Stay (per day)
• Discount if applicable
• Total billing amount
• Payable Amount
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

int main()
{
	do {
		std::cout << "Consider required inputs\n";
		std::cout << "Consider required outputs\n";
		std::cout << "Determine algorithm to derive output from input\n";
		std::cout << "Derive any required data structures\n";
		std::cout << "Design program\n";
		std::cout << "Test design\n";
		std::cout << "Code program from design\n";
		std::cout << "Test and debug program\n";
	} while (!progam_working);

}

Furry Guy once wrote:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <cctype>
#include <limits>

int main()
{
   std::cout << "Do you want someone to do all the work for you? ";
   char answer { };
   std::cin >> answer;

   std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

   if (std::toupper(answer) == 'Y' ) { std::cout << "Post it in the Jobs section.\n"; }

   else { std::cout << "Show what you have coded so far.\n"; }

   std::cout << "Good luck.\n";
}

Maybe you could use this as a start.

Andy

P.S. The people here are not here to do your homework. That is your job.
this is actually really easy and just a few lines. Because it is so simple (its what, 4 lines + I/O and variable defines?), and likely your first program, I did it for you. I did not spend a ton of time on testing it or dong nice input and output prompts etc, but I think it is close, you can polish up the I/O and all.
edit: oops, fixed, I did 3+days not 2+ days initially.
edit2: removed silly multiply by 1.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
string getanswer(int d, int ty)
{
	string ans;
	static const vector<int> rooms{3000,5000,6000,10000};
	static const vector<double> rt{1.0,0.92,0.9,0.88};
	double t{0.0},pa{0.0};
	t = d*rooms[ty];
	pa = t* rt[ ((d>1)&&t>4000) +((d>1)&&t>8000) + ((d>1)&&t>12000) ];
	ans += to_string(t)+" "+to_string(pa); //finish this up for the output
	return ans;
}

int main() 
{
  int duration{0};
  int roomtype{0};
  cout << "how long?\n"; //this can be better. 
  cin >> duration;
  cout <<"type?\n";
  cin >> roomtype;
  cout <<  getanswer(duration,roomtype);  
}


them are some expensive rooms. You in backwards format number country (where comma and decimal are reversed? I used american)??
I only do the raw beginner stuff for people. Next time, you must try to do it yourself or I will not help, as the others have said. All I ask is that if you turn this in, I want to know what the professor had to say about it, as I always like an expert's opinion of my code attempts. Also be sure you understand it; you have to be able to do the first assignments yourself or you will fail the rest quickly as it builds. And ok... the funny wore off, I was messing with you a bit. It works, and it may even be educational to you, but its on par with using calculus to find the area of a rectangle. Try to do it using what you know, post it, and we will help. Cheating won't work for this material, for very long. You may survive the first class but you will very soon be discovered as unable to do even simple things, and whatever consequences will follow.
Last edited on
Hello denny89,

Jonnin's code may be short and to the point if you can use everything he did.

I put a little more time into it and came up with this output:

      Room Types:
----------------------
 1. Economy Single Bed
 2. Economy Two Bed
 3. Luxury Single Bed
 4. Luxury Two Bed
 5. Exit
  Enter choice: a

     Invalid Input! Must be a number.

      Room Types:
----------------------
 1. Economy Single Bed
 2. Economy Two Bed
 3. Luxury Single Bed
 4. Luxury Two Bed
 5. Exit
  Enter choice: 0

     Invalid Choice! Try again.

      Room Types:
----------------------
 1. Economy Single Bed
 2. Economy Two Bed
 3. Luxury Single Bed
 4. Luxury Two Bed
 5. Exit
  Enter choice: 9

     Invalid Choice! Try again.

      Room Types:
----------------------
 1. Economy Single Bed
 2. Economy Two Bed
 3. Luxury Single Bed
 4. Luxury Two Bed
 5. Exit
  Enter choice: 1

 Enter length of stay: 3


 Rate of stay = 9000
 Discount 900
 Total billing amount = 8100
 Payable Amount = 8100


 Press Enter to continue:


Just an idea to get you going.

Andy
Topic archived. No new replies allowed.