Item codes: 100 & 101 & 109
100 - Sweet 'n Ripe Grapes (Price) - 125.35
101 - Crunchy apples (Price) - 52.20
109 - Green Peas (Price) - 25.75
I need 4 sample runs in total here are the sample runs I need
Sample Run 1
Welcome to CS126 Mart!
Item Codes
Description Price
100 Sweet ‘n Ripe Grapes 125.35
101 Crunchy Apples 52.20
… … …
109 Green Peas 25.75
Enter Code: 128
Invalid code.
Sample Run 2
Welcome to CS126 Mart!
Item Codes Description Price
100 Sweet ‘n Ripe Grapes 125.35
101 Crunchy Apples 52.20
… … …
109 Green Peas 25.75
Enter Code: 100
Sweet ‘n Ripe Grapes 125.35
Quantity -3
Invalid code.
#include <iostream>
using namespace std;
int code;
int main()
{
cout << "Welcome to CS126 Mart! \n";
cout << "Item codes: 100 & 101 & 109\n";
cout << "100 - Sweet 'n Ripe Grapes (Price) - 125.35\n";
cout << "101 - Crunchy apples (Price) - 52.20\n";
cout << "109 - Green Peas (Price) - 25.75\n";
cout << "Enter code: ";
cin >> code;
if (code == 100) {
cout << "Sweet ‘n Ripe Grapes 125.75\n";
} else if (code == 101) {
cout << "Crunchy apples 52.20\n";
} else if (code == 109) {
cout << "Green Peas 25.75\n";
} else cout << "Invalid code\n";
return 0;
}
Example:
Welcome to CS126 Mart!
Item codes: 100 & 101 & 109
100 - Sweet 'n Ripe Grapes (Price) - 125.35
101 - Crunchy apples (Price) - 52.20
109 - Green Peas (Price) - 25.75
Enter code: 100
Sweet ‘n Ripe Grapes 125.75
Comments
Leave a comment