Husna Dental is a personal dental clinic that recently operated on 1st January 2015. The payment for dentistry services at Husna Dental is different based on the type of treatment and patient status.
 Patient Status
Restoration (1)
Extraction(2)
Scaling(3)
Children(C)
RM6.00
RM15.50
RM4.00
Adult(A)
RM7.50
RM18.00
RM5.00
  Â
       Due to the opening ceremony, the discount of 20% will be given for children’s treatment and 15% discount for adult’s treatment.
Write a C++ program that performs the following.
· · · ·
a) Reads the patient's name, patient status, and type of treatment.
b) Displays the appropriate message when the user enters an invalid status.
c) Calculates the payment before and after discount.
At the end of the program, displays receipt that contain patient’s name and her/his total payment after discount.
write in switch case method.
#include <iostream>
using namespace std;
int main()
{
  /*
  Reads the patient's name, patient status, and type of treatment.
  */
  char status;
  string name;
  int type_of_treatment;
  cout<<"\nEnter the name of the patient: ";
  cin>>name;
  cout<<"\nEnter the status of the patient: ";
  cin>>status;
  cout<<"\nEnter the type of treatment: ";
  cin>>type_of_treatment;
  double balance;
  Â
  if (status=='C' ||status=='A'){
    //c) Calculates the payment before and after discount.
    //before
    char ch;
    switch(ch){
      case 'C':
        int ch2;
        switch(ch2){
          case 1:
            balance=6.00*1.2;
            break;
          case 2:
            balance=15.00*1.2;
            break;
          case 3:
            balance=4.00*1.2;
            break;
          Â
        }
        break;
      case 'A':
        int ch3;
        switch(ch3){
          case 1:
            balance=6.00*1.15;
            break;
          case 2:
            balance=15.00*1.15;
            break;
          case 3:
            balance=4.00*1.15;
            break;
          Â
        }
        break;
      default:
        break;
    }
    //after discount
    char ch4;
    switch(ch4){
      case 'C':
        int ch2;
        switch(ch2){
          case 1:
            balance=6.00*0.8;
            break;
          case 2:
            balance=15.00*0.8;
            break;
          case 3:
            balance=4.00*0.8;
            break;
          Â
        }
        break;
      case 'A':
        int ch3;
        switch(ch3){
          case 1:
            balance=6.00*0.85;
            break;
          case 2:
            balance=15.00*0.85;
            break;
          case 3:
            balance=4.00*0.85;
            break;
          Â
        }
        break;
      default:
        break;
    }
    cout<<"Name: "<<name<<" balance: "<<balance;
  }
  //b) Displays the appropriate message when the user enters an invalid status.
  else{
    cout<<"You entered invalid status";
  }
  return 0;
}
Comments
Leave a comment