Untitled

 avatar
unknown
c_cpp
2 years ago
8.3 kB
4
Indexable
# include <iostream>
# include <string.h>
using namespace std;

int main ()
{
    
	char bookCode [3], bookGenre [20], membership;
	int  bookQuantity;
	double price, priceAfterDiscount, payment, discount, balance;
	
	
	
	cout<<"******WELCOME TO ALYAZZ BOOKSTORE******\n"<< endl;
	
	cout<<"List Of Book and Genre in the store\n"<<endl;
	cout<<"//=====================[]==================================[]=======\\"<<endl;
	cout<<"||    Genre of book    ||     Code and Title of Book       || Price ||"<<endl;
	cout<<"|]=====================[]==================================[]=======[|"<<endl;
	cout<<"|| 1-Action/adventure  || DPK- Daughter of The Pirate King || Rm 32 ||"<<endl;
	cout<<"||                     || PLL- Pretty Little Liars         || Rm 34 ||"<<endl;
	cout<<"||                     || HPD- Harry Potter-Deathly hollows|| Rm 45 ||"<<endl;
	cout<<"||---------------------||----------------------------------||-------||"<<endl;
	cout<<"|| 2-Romance           || TIL- So This Is Love             || Rm 35 ||"<<endl;
	cout<<"||                     || CHT- Comando His Tressure        || Rm 32 ||"<<endl;
	cout<<"||                     || MIE- Mi Esposa                   || Rm 38 ||"<<endl;
	cout<<"||---------------------||----------------------------------||-------||"<<endl;
	cout<<"|| 3-Fantasy           || VSK- Vow Of The Shadow King      || Rm 36 ||"<<endl;
	cout<<"||                     || ATM- An Arrow to The Moon        || Rm 38 ||"<<endl;
	cout<<"||                     || TSC- The shattered city          || Rm 35 ||"<<endl;
	cout<<"||---------------------||----------------------------------||-------||"<<endl;
	cout<<"|| 4-Family/Friendship || FLT- Friends like These          || Rm 25 ||"<<endl;
	cout<<"||                     || PFS- Postcard from summer        || Rm 44 ||"<<endl;
	cout<<"||                     || LOP- Loving our parents          || Rm 34 ||"<<endl;
	cout<<"||---------------------||----------------------------------||-------||"<<endl;
	cout<<"|| 5-Horror/Paranormal || CON- City of Nightmare           || Rm 38 ||"<<endl;
	cout<<"||                     || CFU- Where he can't find you     || Rm 41 ||"<<endl;
	cout<<"||                     || AS3- Asr4ma-3                    || Rm 46 ||"<<endl;
	cout<<"||---------------------||----------------------------------||-------||"<<endl;
	cout<<"|| 6-Historical fiction|| COR- Castle Of Refudge           || Rm 40 ||"<<endl;
	cout<<"||                     || AIS- Ashes in the snow           || Rm 45 ||"<<endl;
	cout<<"||                     || PKA- Palestin:Kemenangan abadi   || Rm 42 ||"<<endl;
	cout<<"||---------------------||----------------------------------||-------||"<<endl;
	cout<<"|| 7-Science fiction   || SOE- Satellite of Earth          || Rm 42 ||"<<endl;
	cout<<"||                     || TSK- The skinner                 || Rm 56 ||"<<endl;
	cout<<"||                     || TSP- The starpoint               || Rm 59 ||"<<endl;
	cout<<"\\=====================[]==================================[]=======//\n"<<endl;
	
	
	 cout<<"~~~~~Enter the details of the book that customers want to purchase~~~~~\n "<<endl;
	 cout<<"Enter the book genre : "; // customers have to choose the genre in the table
	 cin.getline(bookGenre, 20);
	 cout<<"Enter the book code: "; // customers have to write the book code that they want to buy in the table, (cth: Comando His Tressure, code: CHT)
	 cin>>bookCode;
	 cout<<endl;
	 cout<<"Enter the book quantity that you want to buy: "; // quantity of the book that customers want to purchase
	 cin>>bookQuantity;
	 
	 
	 
	 if (strcmp(bookGenre, "Action/adventure")==0)
	 {
	
	    if(strcmp(bookCode,"DPK")== 0)
	    {
	         price = bookQuantity * 32;
	         cout<<"Title of book: Daughter of The Pirate King"<<endl;
	    }
	         
	    else if (strcmp(bookCode, "PLL")== 0)
	    {
	 	     cout<<"Title of book: Pretty Little Liars "<<endl;
		     price = bookQuantity * 34;
		}
		     
	     else if (strcmp(bookCode, "HPD")== 0)
	    {
		     cout<<"Title of book: harry potter-Deathly hollows"<<endl;
	         price = bookQuantity * 45;
	    }
	}
	   
	         
	         
	  if (strcmp(bookGenre, "Romance")==0)
	  {
	
	    if (strcmp(bookCode, "TIL")== 0)
	    {
	         cout<<"Title of book: So This Is Love"<<endl;
		     price = bookQuantity * 35;
		}
		     
		else if (strcmp(bookCode, "CHT")== 0)
		{
		     cout<<"Title of book: Comando His Tressure"<<endl;
		     price = bookQuantity * 32;
		}
		     
		else if (strcmp(bookCode, "MIE")== 0)
		{
		     cout<<"Title of book: Mi Esposa"<<endl;
		     price = bookQuantity * 38;
		}
	}
		         
	  if (strcmp(bookGenre, "Fantasy")==0)  
	  {
	
		if (strcmp(bookCode, "VSK")== 0)
		{
		     cout<<"Title of book: Vow Of The Shadow King"<<endl;
		     price = bookQuantity * 36;
		}
		     
		else if (strcmp(bookCode, "ATM")== 0)
		{
		     cout<<"Title of book: An Arrow to The Moon"<<endl;
		     price = bookQuantity * 38;
		}
		     
		else if (strcmp(bookCode, "TSC")== 0)
		{
		     cout<<"Title of book: The shattered city"<<endl;
		     price = bookQuantity * 35;
		}
	}
		     
		
	  if (strcmp(bookGenre, "Family/Frienship")==0) 
	  {
	
		if (strcmp(bookCode, "FLT")== 0)
		{
		     cout<<"Title of book: Friends like These"<<endl;
		     price = bookQuantity * 25;
		}
		     
		else if (strcmp(bookCode, "PFS")== 0)
		{
		     cout<<"Title of book: Postcard from summer"<<endl;
		     price = bookQuantity * 44;
		}
		     
		else if (strcmp(bookCode, "LOP")== 0)
		{
		     cout<<"Title of book: Loving our parents"<<endl;
		     price = bookQuantity * 34;
		}
	}
		    
		
	  if (strcmp(bookGenre, "Horror/Paranormal")==0)
	  {
	
		if (strcmp(bookCode, "CON")== 0)
		{
		     cout<<"Title of book: City of Nightmare"<<endl;
	         price = bookQuantity * 38;
	    }
	         
	    else if (strcmp(bookCode, "CFU")== 0)
	    {
	         cout<<"Title of book: Where he can't find you"<<endl;
	         price = bookQuantity * 41;
	    }
	         
	    else if (strcmp(bookCode, "AS3")== 0)
	    {
		     cout<<"Title of book: Asr4ma-3 "<<endl;
		     price = bookQuantity * 46;
		}
	}
	
	  if (strcmp(bookGenre, "Historical fiction")==0)
	  {
	
	    if (strcmp(bookCode, "COR")== 0)
	    {
		     cout<<"Title of book: Castle Of Refudge"<<endl;
		     price = bookQuantity * 40;
		}
		     
	    else if (strcmp(bookCode, "AIS")== 0)
	    {
		     cout<<"Title of book: Ashes in the snow"<<endl;
		     price = bookQuantity * 45;
		}
		     
		else if (strcmp(bookCode, "PKA")== 0)
		{
		     cout<<"Title of book: Palestin:Kemenangan abadi"<<endl;
		     price = bookQuantity * 42;
		}
	}
	
	  if (strcmp(bookGenre, "Science fiction")==0)
	  {
	
		 if (strcmp(bookCode, "SOE")== 0)
		{
		     cout<<"Title of book: Satellite of Earth"<<endl;
		     price = bookQuantity * 42;
		}
		     
		else if (strcmp(bookCode, "TSK")== 0)
		{
		     cout<<"Title of book: The skinner"<<endl;
		     price = bookQuantity * 56;
		}
		     
		else if (strcmp(bookCode, "TSP")== 0)
		{
		     cout<<"Title of book: The starpoint"<<endl;
	         price = bookQuantity * 59;	
	    }
	    
	    else
	    {
	        cout<<"SORRY WE DONT'T HAVE THE BOOK!!! :("<<endl;
		    return 0;
	    }
	    cout<<"The price is: RM "<<price<<endl;
       }
	
	cout<<endl;
	cout<<"Membership Discount : 20% "<<endl;
	cout<<"Got membership?? (Y/N): "; // if customer have membership, they got discount 20% off
	cin>>membership;
	cout<<"\nCustomer Payment: RM "; // payment from customers
	cin>>payment;
	
	
	if (membership == 'Y')
	{
	     priceAfterDiscount = price - (price * 0.2);
	     balance = payment - priceAfterDiscount;
	}
	else
	{
	     price = price;
	     balance = payment - price;
    }
	
	cout<<endl;
	cout<<endl;  
	   
	cout<<"^^^^^^^^^DETAIL FOR THE BOOK THAT YOU PURCHASE^^^^^^^^^^"<<endl;
	cout<<"\nPrice before discount: RM "<<price<< endl;
	cout<<"Price after discount: RM  "<<priceAfterDiscount<< endl;
	cout<<"Customer payment is: RM "<<payment<<endl;
	cout<<"Customer  balance is: RM "<<balance<<endl;
    cout<<"\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
	cout<<endl;
    cout<<"Thank you for buying from Alyazz Bookstore, Please come again~ ^-^ "<<endl;
    cout<<"Enjoy your reading bookworm!!!! :)"<<endl;

   
	return 0;
	
	
	
}
Editor is loading...
Leave a Comment