Kindly explain your observations in these
codes:
(What have you observed on the
program?)
(What have you learned from the
program?)
Code 1:
#include <iostream> using namespace std; int main() { int x; cout << "Enter Account Number (-1 to end) : "; cin >> x; C:\Users\erika mae\OneDrive\Pictures Documents\Downloads\bank.exe Enter Account Number (-1 to end) : 0123712093 Your starting balance is: Php 10000 1. Pay all items using credit. 2. Pay items in portions using credit. Please select 1 or 2: 2 Pay in portions using credit. Enter total amount of purchase: Php 12000 New credit balance is: Php -2000 Credit limit exceeded. Enter Account Number (-1 to end) : -1 Transaction Terminated. Process exited after 9.409 seconds with return value o Press any key to continue . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 = 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 = 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 int startingbalance; startingbalance = 10000; cout << "\nYour starting balance is: Php " << startingbalance<< "\n"; int option; cout << "\n 1. Pay all items using credit."; cout << "\n 2. Pay items in portions using credit." << "\n"; cout << "\nPlease select 1 or 2: " << "\n"; cin >> option; switch (option) { case 1: cout << "Pay all using credit." << "\n"; break; case 2: cout << "Pay in portions using credit.\n"; break; default: : cout << "Enter Account Number (-1 to end) : "; cin >> x; } int purchaseamount; int creditavailable; cout << "\tEnter total amount of purchase: Php"; cin >> purchaseamount; creditavailable = startingbalance-purchaseamount; - cout << "\nNew credit balance is: Php " << creditavailable << "\n"; switch (creditavailable) { case 1: cout << "Credit is negative"; break; case 2: cout << "Credit is positive"; break; default: cout << "\tCredit limit exceeded. \n"; } cout << "Enter Account Number (-1 to end) : "; cin >> X; if(x=-1); cout << "Transaction Terminated."; return; }
[*] Untitledó lab acto (2).cpp #include <iostream> 2 using namespace std; C:\Users\erika mae\OneDrive Pictures\Documents\Downloads\lab act6 (2).exe Enter sales in dollars from last week (-1 to end): $900 Salary is: $281 int main() { double sales, wage; cout << "Enter sales in dollars from last week (-1 to end): $"; cin >> sales; Enter sales in dollars from last week (-1 to end): $320 Salary is: $228.8 10 while sales != -1.0 Enter sales in dollars from last week (-1 to end): $490 Salary is: $244.1 12 13 14 15 16 17 18 19 wage = 200.0 + 0.09 * sales; cout << "Salary is: $" << wage; cout << "\n\nEnter sales in dollars from last week (-1 to end): $"; cin >> sales; } Enter sales in dollars from last week (-1 to end): $1233 Salary is: $310.97 Enter sales in dollars from last week (-1 to end): $-1 return; Process exited after 17.44 seconds with return value o Press any key to continue
Kindly explain your observations in these codes: (What have you observed on the program?) (What have you learned from th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am