A software company sells a package that retails for $99. Quantity discounts are given according to the table
Quantity Discount
10-19 20%
20-49 30%
50-99 40%
100 or more 50%
Write a program that asks for the number of units purchased and computes the total cost of the purchase. Make sure the number of units is greater than 0.
Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “ Too high. Try again. ” If the user’s guess lower than the random number, the program should display “ Too low. Try again.” The program should use a loop that repeats until the user correctly guesses the random number. Then the program should display “ Congratulations. You figured it out my number.”
Write a program that asks the user to enter an item’s wholesale cost and its markup percentage. It should then display the items retail price. For example
The program should have a function named calculateRetail that receives the wholesale cost and the markup percentage as arguments, and returns the retail price of the item.
Do not accept negative value for either the wholesale cost of the item or the percent markup.
The formula is for converting a temperature from Fahrenheit to Celsius is
C= 5/9 (F-32)
Where F is the Fahrenheit temperature and the C is the Celsius temperature. Write a function named Celsius that accepts a Fahrenheit temperature as an argument. The function should return the temperature, converted to Celsius. Demonstrate the function by calling it in a loop that displays a table of the Fahrenheit temperatures 0 through 20 and their Celsius equivalents.
Write a program that uses a structure named MovieData to store the following information about a movie:
Title:
Director:
Year Released:
Running Time (in minutes)
Include a constructor that allows all four of these member data values to be specified at the time a MovieData is created. The program should create two MovieData variables and pass each one in turn to a function that displays the information about the movie in a clearly formatted manner.
Write a program that simulates a lottery. The program should have an array of 5 integers named winningDigits, with a randomly generated number in the range of 0 through 9 for each element in the array. The program should ask the user to enter 5 digits and should store them in a second integer array named player. The program must compare the corresponding elements in the two arrays and count how many digits match. Once the user has entered a set of numbers, the program should display the winning digits and the player’s digits and tell how many matched.
Do not accept player inputs less than 0 or greater than 9.
A lottery ticket buyer purchases ten tickets a week, always playing the same ten five-digit “lucky” combinations. Write a program that initializes an array with these numbers and then lets the player enter this week’s winning five-digit number. The program should perform a linear search through the list of the player’s numbers and report whether or not one of the tickets is a winner this week. Here are the numbers:
13579 26791 26792 33445 55555
62483 77777 79422 85647 93121
Write a program that dynamically allocates an array large enough to hold a user-defined number of test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average test score. The program should display the sorted list of scores and averages with appropriate headings. Use pointer notation rather than array notation whenever possible.
Do not accept negative numbers for test scores.