Advertisement
Spocoman

Agency Profit

Sep 14th, 2023
1,179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     string agency;
  8.     getline(cin, agency);
  9.  
  10.     int ticket, kidTicket;
  11.     cin >> ticket >> kidTicket;
  12.  
  13.     double ticketPrice, service;
  14.     cin >> ticketPrice >> service;
  15.  
  16.     double totalAdult = (ticketPrice + service) * ticket;
  17.     double totalKid = (0.3 * ticketPrice + service) * kidTicket;
  18.     double total = (totalAdult + totalKid) / 5;
  19.  
  20.     printf("The profit of your agency from %s tickets is %.2f lv.", agency.c_str(), total);
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement