Question

1. Credit Card Number Verification Program:
First your program should ask if the credit card is MasterCard or Visa card.
Then ask the 16 digit credit card number.
Then add all the digits in the credit card number and get the modulo 10.
If the modulo 10 of the summation of all the digits is zero, then its valid visa card.
If the modulo 10 of the summation of all the digits is 1 then its valid MasterCard.
Otherwise, the number customer has entered is an invalid card number.
For example, say the card number is 1234 5678 6789 1235 and its visa card.
To validate it, first add all the digits 1+2+3+4+5+6+7+8+6+7+8+9+1+2+3+5 = 77 then get mod 10 of 77 (77%10 = 7)
Since it’s not zero,this is not a valid visa card number.
Write a C++program that reads the card type and the card number and then determine if the card number entered is a valid card number.

2. Watermelon Program:
Suppose Dave drops a watermelon off a high bridge and lets it fall until it hits the water.
If we neglect air resistance, then the distance d in meters fallen by the watermelon after t seconds is d=0.5*g*t², where the acceleration of gravity g=9.8meters/second.
Write a program that asks the user to input the number of seconds that the watermelon falls and the height h of the bridge above the water.
The program should then calculate the distance fallen for each second from t=0 until the value of t input by the user.
If the total distance fallen is greater than the height of the bridge, then the program should tell the user that the distance fallen is not valid.
Sample Run 1:
Please input the time of fall in seconds:
2
Please input the height of the bridge in meters:
100
Time Falling (seconds) DistanceFallen (meters)
*******************************************
00
14.9
219.6
Sample Run 2:
Please input the time of fall in seconds:
4
Please input the height of the bridge in meters:
50
Time Falling (seconds) Distance Fallen (meters)
*******************************************
00
14.9
219.6
344.1
478.4
Warning-Bad Data: The distance fallen exceeds the height of the bridge

3. Snow Fall Program:
A Write a program that can be used by a ski resort to keep track if local snow conditions for one week.
It should have two seven-element arrays to store the date and number of inches of snow.
First, the program should ask the user to enter the name of the month.
Then, it should have the user enter dates (dates does not need to be in sequential order) and corresponding snow fall. Once data is entered, store them in two arrays mentioned above.
Then, the program should produce a report for the week with following information.
Use arrays to store snowfall and corresponding dates.
a) Highest snow fall
b) Average snow fall
Here is a sample report
Snow Report December
=================
Date Snow Fall
1 89.00
5 67.98
12 56. 83
13 12.45
16 100.67
20 78.76
25 34.65
Height snow fall is 100.67 on 16th and the average snow fall is 62.90

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

int main(int argc, char** argv) {   
   
    int type = getCardType();
    string number = getcCardNumber();
    int check = cardChecking(number);
   
    if (check == type) {
       cout << "The card number entered is a valid card number\n";
    } else {
       cout << "The card number entered is not a valid card number\n";
    }
      
   
    return 0;
}...

This is only a preview of the solution. Please use the purchase button to see the entire solution

$25.00

or free if you
register a new account!

Assisting Tutor

Related Homework Solutions

Get help from a qualified tutor
Live Chats