0% found this document useful (0 votes)
4 views3 pages

Include

This C++ program calculates the total ticket price for bus purchases based on the destination (Bandung or Jakarta) and type of bus (non-ac, ac, or se). It also provides bonuses such as snack boxes or meals depending on the bus type and applies a discount for purchases of more than three tickets. The program outputs the buyer's name, bus type, number of tickets, ticket price, bonus, and total amount to be paid.

Uploaded by

artayan1325
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Include

This C++ program calculates the total ticket price for bus purchases based on the destination (Bandung or Jakarta) and type of bus (non-ac, ac, or se). It also provides bonuses such as snack boxes or meals depending on the bus type and applies a discount for purchases of more than three tickets. The program outputs the buyer's name, bus type, number of tickets, ticket price, bonus, and total amount to be paid.

Uploaded by

artayan1325
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#include <iostream>

using namespace std;

int main(){

int ht, tb, jt, bd, jbr;

string jb, jr, bn, np;

cout<<"Nama Pembeli = ";

cin>>np;

cout<<"Jurusan Bus(Bandung/Jakarta) = ";

cin>>jr;

cout<<"Jenis bus(ac/nonac/se) = ";

cin>>jb;

cout<<"Jumlah Tiket Yang dI beli = ";

cin>>jt;

if(jr=="bandung"){

if(jb=="nonac"){

ht = 90000;

bn = "Tidak Ada";

tb = jt*ht;

}else if(jb=="ac"){

ht = 150000;

bn = "2 x Snack Box";

tb = jt*ht;

}else{

ht = 225000;

bn = " 2x Snack Box + 4x makan";

tb = jt*ht;

}
if(jr=="jakarta"){

if(jb=="nonac"){

ht = 70000;

bn = "Tidak Ada";

tb = jt*ht;

}else if(jb=="ac"){

ht = 120000;

bn = " Tidak Ada";

tb = jt*ht;

}else{

ht = 200000;

bn = " 1x Snack Box + 2x Makan";

tb = jt*ht;

if(jt>3){

bd = (jt*ht) / 0.15;

}else{

jbr = tb - bd;

cout<<"Nama Pembeli = "<<np<<endl;

cout<<"Jurusan Bus = "<<jb<<endl;

cout<<"Jumlah Tiket = "<<jt<<endl;

cout<<"Harga Tiket = "<<ht<<endl;

cout<<"Bonus Diskon = "<<bd<<endl;

cout<<"Jumlah Bayar = "<<jbr<<endl;

return 0;

You might also like