What data type would you use to store a phone number a


QUESTION 1

It costs 25 cents per mile to catch a taxi in Kalamazoo. There is a $4.00 charge, just to get in the car. There is also a special where it costs you 25 dollars to have an all day pass. Write a program that helps you calculate whether it would make more sense for you to pay per mile versus getting the all day pass. Your output should look like

It costs you X to travel this many miles. It would be be a better decision to [insert decision here]

Your decision would be it would make more sense to get the special if the per mile cost is > 25

QUESTION 2

If we list all of the numbers below 10 that are multiples of 3 and 5, we get 3,5,6 and 9. The sum of these is 23. Write a program that lists the sum of all multiples below 1000 that are divisible by 3 and 5.

QUESTION 3

How would you check if a response a user has provided to your program is an integer?

QUESTION 4

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed 1000, print the values that are even numbers.

QUESTION 5

What data type would you use to store a phone number? A dollar amount?

QUESTION 6

What is the difference between a while loop and a do..while loop?

QUESTION 7

Write a program that asks a user for five grades. Your program should then calculate these grades and find the average. Based upon this average, you should tell them what their letter grade is (pending the normal grade scale of above a 90 = A, 80-90 = B, etc.

QUESTION 8

Create a program that asks the user for input. It should ask for a single number and then create the matching multiplication table for that number. For example, if the user enters the number 10, your output should look EXACTLY like the following

Muliplication Tables For 10

10 X 1 is 10
10 X 2 is 20
10 X 3 is 30
........
10 X 10 is 100

QUESTION 9

Name three different String functions that we have used

QUESTION 10

What two things do you need to use in order to ask a user for input?

QUESTION 11

How many times does the following run:

for(int x = 0;x<100;x++)
{
x++
x*=2
x--
}

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: What data type would you use to store a phone number a
Reference No:- TGS01520664

Now Priced at $35 (50% Discount)

Recommended (92%)

Rated (4.4/5)