Sample Run 3
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: 101
Crunchy Apples 52.20
Quantity 1 Total Amount Due: 52.20
Cash: 50.00
Insufficient Cash
Sample Run 4 will be
Enter Code: 101 and will buy Crunchy apples (1 quantity) and will pay (Cash: 1000) and the change will be 947.80 and the program will say "Take care!" at the end
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.
The circumference of a rectangle is 2*(length + width), where length and width are length and width of the rectangle. Write a program that asks for the length and width of two rectangles. The program should tell the user which rectangle has the greater circumference, or if the circumferences are the same.
The circumference of a rectangle is 2*(length + width), where length and width are
length and width of the rectangle. Write a program that asks for the length and width of
two rectangles. The program should tell the user which rectangle has the greater
circumference, or if the circumferences are the same
You are to write a C++ program to calculate the monthly car payment(s) for a customer. You have probably read ahead in your textbook and know that it would be really neat to use functions for this task. Unfortunately, you have not had functions yet and you must resort to a linear straight-line program. (In other words, you are NOT to use functions.) As much as possible you are to develop the code as modular building blocks. You are encouraged to use functional decomposition to design your program. You are to USE NO GLOBAL VARIABLES in your work. You should manually calculate some values to ensure that your program is working correctly.
Create a constructor that will allow anyone using the class to set the initial value of the card's suit and rank.
Create a method that will get a cards value. This should be based on the card's rank.
2-10 will use that as their value
face cards will use 10 as their value
Aces will have a value of 11
Aces will have an alternate value of 1
Make a method that will get a cards alternate value. This is based on Black Jack where Ace's can be 11 or 1.
If a card doesn't have an alternate value this method should return the card's normal value.
Create a static method that takes in two cards and returns -1, 0, or 1 based on comparing those card's values.
-1 means card 1 has a higher value
0 means the cards have the same value
1 means card 2 has a higher value
Make getter methods for the card's rank and suitMake a method to draw the card's face at a specific location on the screen passed into the method as an x and y value.
Write a Program: Compute an average of integer values
Ask the user to enter a number of values to average in the range from 2 to 10. Use
a loop to make sure the entered number is within the range. Output an error
message any time an invalid number is entered.
Once a valid number of values is entered ask the user to input each value.
Enumerate the values being asked for (see the output example). Your goal is to calculate their average and output it to the console
Following Program
Once you get a valid number of values ask for each value individually. Enumerate each value you are asking for.
Define 3 named constants.
Ask the user to enter a number of values and read it from the console.
Calculate the average and output it to the console. 3 digits after decimal point.
Create your variables, use the appropriate type, name them appropriately (camelback notation), and remember to not leave them uninitialized.
1. Will the following lines of code print the same thing? Explain why or why not.
std::cout << 6 << '\n';
std::cout << "6" << '\n';