C++ Arithmetic Operator Computes video rental amounts

Description

C++ Arithmetic Operator Computes video rental amounts

#include <iostream>
using namespace std;
#include <stdio.h>
int main()// w ww . jav a  2 s .  c  o  m
{
   float tape_charge, discount, rental_amt;
   char first_name[15];
   char last_name[15];
   int num_tapes;
   char val_day, sp_stat;

   tape_charge = 2.00;
   // Before-discount tape fee-per tape.
   // Receive input data.
   cout << "\nWhat is customer's first name? ";
   cin >> first_name;
   cout << "What is customer's last name? ";
   cin >> last_name;
   cout << "\nHow many tapes are being rented? ";
   cin >> num_tapes;
   cout << "Is this a Value day (Y/N)? ";
   cin >> val_day;
   cout << "Is this a Special Status customer (Y/N)? ";
   cin >> sp_stat;
   // Calculate rental amount.
   discount = 0.0;   // Increase discount if they are eligible.
   if ((val_day == 'Y') || (sp_stat == 'Y'))
   {
      discount = 0.5;
      rental_amt=(num_tapes*tape_charge)
      (discount*num_tapes);
   }
   // Print the bill.

   cout << "\n\n** Rental Club **\n\n";
   cout << first_name << " " << last_name << " rented " << num_tapes << " tapes\n";

   printf("The total was %.2f\n", rental_amt);
   printf("The discount was %.2f per tape\n", discount);

   if (sp_stat == 'Y')
   {
      cout << "\nThank them for being a Special "<< "Status customer\n";
   }
   return 0;
}



PreviousNext

Related