Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Answer Booklet CSC126 Individual Lab Assignment (25%)

Section A

Complete student details:

Full Name: NADIAH FARISHA BINTI MOHD FAIZAL


Student ID: 2021649984
Group: JCS1101I

Section B

Copy and paste the codes of your complete C++ program inside here:

#include <iostream>
#include <string>

using namespace std;

int main()
{
//declaration
const double DISCOUNTVOUCHER = 0.40;
string name, id, facilities, items;
int numberOfPerson = 0, numberOfDays = 0, numOfBreakfast = 0, numOfHammock = 0,
numOfRod = 0, numOfPowerSocket = 0, numOfWarmWater = 0;
char breakfast, hammock, fishingRod, powerSocket, warmWaterShower, discountVoucher,
paymentMethod, totalBreakfast, totalHammock, totalFishingRod, totalPowerSocket,
totalWarmWater;
double fee, totalfee;

//INPUT
cout << "Enter your name: " << name << ;
getline(cin, name);
cout << "Enter your id number : ";
cin >> id;
cout << "Number of persons in the group : ";
cin >> numberOfPerson;
cout << "Number of days stayed : ";
cin >> numberOfDays;
cout << "Do you want to include breakfast [1-Yes|2-No]?";
cin >> breakfast;
cout << "Number of person[s] for breakfast : ";
cin >> numOfBreakfast;
cout << "Do you want to include hammock [1-Yes|2-No]?";
cin >> hammock;
cout << "do you want to include fishing rod [1-Yes|2-No]? ";
cin >> fishingRod;
cout << "Do you want to include power socket [1-Yes|2-No]? ";
cin >> powerSocket;
cout << "Do you want to include warm water shower [1-Yes|2-No]";
cin >> warmWaterShower;
cout << "Choose payment method : \nT - Touch 'n Go eWallet \nG - Grab Wallet \nS -
ShopeePay \nOther than above - Cash/Card - No Discount!";
cin >> paymentMethod;

//process
{
if (breakfast == '1')
{
cout << "Number Of Person[s] for breakfast : " << numOfBreakfast << endl;
}
else if (hammock == '1')
{
cout << "Number of Hammock[s] : " << numOfHammock << endl;
}
else if (fishingRod == '1')
{
cout << "Number of Rod[s] : " << numOfRod << endl;
}
else if (powerSocket == '1')
{
cout << "Number of socket[s] : " << powerSocket << endl;
}
else if (warmWaterShower == '1')
{
cout << "Number of person[s] for warm water : " << warmWaterShower << endl;
}
}

{
if (facilities == "basic")
{
items == "Family Tent (6 people per set), cushion seat & pillow, sleeping bag and foam
mattress, Private dining & Coffee Table, Camp Fire,BBQ Equipments & Dining area";
fee == 400;
}
else if (facilities == "breakfast")
{
breakfast = 10;
totalBreakfast = numOfBreakfast * breakfast;
}
else if (facilities == "hammock")
{
hammock == 15;
totalHammock == numOfHammock * hammock;
}
else if (facilities == "fishing Rod")
{
fishingRod == 35;
totalFishingRod = numOfRod * fishingRod;
}
else if (facilities == "Electricity")
{
powerSocket == 50;
totalPowerSocket == numOfPowerSocket * powerSocket;
}
else if (facilities == "Warm Water Shower")
{
warmWaterShower == 10;
totalWarmWater == numOfWarmWater * warmWaterShower;
}
}

fee = numberOfPerson * numberOfDays;


totalfee = fee * fee;

//output
cout <<
"\n=============================================================================
=====================" << endl;
cout << "\n\t\t\t INVOICE RECIPT \t\t\t" << endl;
cout <<
"\n=============================================================================
=====================" << endl;
cout << "No of persons\t\t : \t\t " << numberOfPerson << endl;
cout << "No of day[s]\t\t : \t\t " << numberOfDays << endl;
cout << "BASIC FEE\t\t = \t\t " << fee << endl;
cout << "Breakfast\t\t : \t\t " << fee << endl;
cout << "Hammock\t\t : \t\t" << fee << endl;
cout << "Fishing rod\t\t : \t\t " << fee << endl;
cout << "Electricity\t\t : \t\t " << fee << endl;
cout << "Warm shower\t\t : \t\t " << fee << endl;
cout << "ADD-ONS FEE\t\t =\t\t " << fee << endl;
cout << "SUB TOTAL\t\t =\t\t " << fee << endl;
cout << "Payment via\t\t :\t\t " << fee << endl;
cout << "Total DUE\t\t =\t\t " << fee << endl;
cout << "\nPaid by\t\t :\t\t " << name << endl;

return 0;
}

Section C

Insert the screen-shot of the console that shows the input and output of your program:
(even if your program does not get the correct output / incomplete)
Output for Situation 1

Output for Situation 2

Section D

If your program has errors/warnings, insert the screen-shot that shows the error/warning line
number(s) and message(s).

You might also like