Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10. int clientNumber;
  11. string clientName;
  12. double tax;
  13. int minTax;
  14. int talkedMin;
  15. string input;
  16. double extraTax;
  17. double perminute;
  18. double sum;
  19.  
  20. cout << "A list of all the contracts: \n";
  21. cout << "Minutes included: 10 , Tax: 20 \n";
  22. cout << "Minutes included: 20 , Tax: 30 \n";
  23. cout << "Minutes included: 30 , Tax: 40 \n" << endl;
  24.  
  25. ofstream append("file.txt", ios::app);
  26. do
  27. {
  28. cout << "Enter the number of the client: ";
  29. cin >> clientNumber;
  30. cout << "Enter the client name: ";
  31. cin >> clientName;
  32. cout <<"Enter the tax:";
  33. cin >> tax;
  34. cout << "Enter the minutes included in the contract: ";
  35. cin >> minTax;
  36. cout << "Enter the minutes talked: ";
  37. cin >> talkedMin;
  38. cout << "Would you like to proceed with another client? (yes/no?)";
  39. cin >> input;
  40.  
  41. append<< clientNumber << " " << clientName << " " << tax << " " << minTax << " " << talkedMin;
  42. }
  43. while(input !="no");
  44. cout << " " << endl;
  45. cout << "How much will be the tax for every minute above those in the contract? ";
  46. cin >> perminute;
  47.  
  48. ifstream appendsec("file.txt", ios::app);
  49. if (minTax < talkedMin)
  50. {
  51. sum = (talkedMin - minTax)*perminute;
  52. cout << "The client with number: " << clientNumber << " has overpassed his/hers minutes included in the contract! New tax is: " << sum + tax <<endl;
  53. }
  54. else
  55. {
  56. cout << "Everything is good with this client!" << endl;
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement