0% found this document useful (0 votes)
11 views

Exercise On Nested Selection

Uploaded by

2022850052
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Exercise On Nested Selection

Uploaded by

2022850052
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Exercise on Nested Selection [ 02052023 ]

Write a complete program using C++. Prepare the IPO, Complete Coding and
Samples of output.

1.IPO
Input
Property code, residence code, assessed value

Process
If (propertycode == 1)
If (residencecode== 1)
propertytype = Home
residencetype = Primary
tax = 0.032
Else
propertytype = Home
residencetype = Non Primary
tax = 0.041

Else
If (residencecode== 1)
propertytype = Commercial
residencetype = Building
tax = 0.062

Else
propertytype = Commercial
residencetype = Land only
tax = 0.053

amount = tax *assessed

Output
Property type, Residence type, assessed value, total amount

Coding

#include <iostream>

#include <iomanip>

using namespace std;

int main()

int propertycode, residencecode;

float amount, assessed, tax;

string propertytype, residencetype;


cout << "1. Home";

cout << "\n2. Commercial";

cout << "\nPlease enter the type of property :";

cin >> propertycode;

cout << "\n1. Primary (Home) @ Building (Commercial)";

cout << "\n2. Non Primary (Home) @ Land only (Commercial)";

cout << "\nPlease enter the type residency :";

cin >> residencecode;

cout << "\nAssessed value of the property : RM ";

cin >>assessed;

if (propertycode == 1)

if (residencecode == 1)

propertytype = "Home";

residencetype = "Primary";

tax = 0.032;

else

propertytype = "Home";

residencetype = "Non Primary";

tax = 0.041;

else

{
if (residencecode== 1)

propertytype = "Commercial";

residencetype = "Building";

tax = 0.062;

else

propertytype = "Commercial";

residencetype = "Land only";

tax = 0.053;

amount = tax * assessed;

cout << fixed << setprecision(2);

cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

cout << "\n Property type entered: \t" << propertytype;

cout << "\n Residence type entered: \t" << residencetype;

cout << "\n Assessed value entered: \tRM " << assessed;

cout << "\n Total amount that have to pay: RM " << amount;

cout << "\nThank you for using our service :)";

Result

You might also like