SineCosine 1

The exponential, sine, and cosine series function are as follows:
x =
sin x =
cos x =
a. Write a C++ program that calculates the series e
, sin x and cos x, where the user enters value
of x and the n the number of terms in the series. (Note: you may have to convert degrees to
radians for sin and cos functions). Note that the program should use functions for each of
the series. 12 Points
b. Draw a detailed flow chart on how this program is being designed, indicating the necessary inputs,
outputs and the algorithm you have used. The flow chart should be included as a document file
along with your program listing (source code). 4 Points
c. Now do a convergence study using different values of n for a given value of x and plot the
convergence graph.

Will I eat lunch

Will I eat lunch 2

Write the “Will I eat lunch” program (Use Nested If statements). Declare variables for each criteria. (haveMoney, haveTime, amHungry, restaurantOpen, haveTransportation ) Have the user input the values for each criteria. Use Nested if statements to determine if user will eat lunch today. Inform the user why they are or are not having lunch at McDonalds.


MobilePhoneBill 3

Write a C program to calculate the amount of a simple mobile phone bill. A call is charged 30 cents per minute. The cost for line rental data is RM39.00 per month. The tax for the overall bill is 6%. Calculate the total amount the user needs to pay to the Telco based on the number of minutes the user uses his/her mobile phone for call every month. Creatively do the input/output format of the program.


ImprovedContains 4

Write a function, ImprovedContains, that takes three arguments: a string representing the text to search, a string representing the pattern to search for, and a pointer to bool that represents if the search should be case insensitive. This function should return true if the pattern is found in the text, false otherwise.


ArchitectAreaCalculator 5

An Architect company needs a program to calculate the area of different shapes (rectangles, triangles and circles) based on their dimensions given by the user. The program must first display a menu that allows the user to select a shape. The program must then allow the user to enter the dimension(s) of the chosen shape and compute the area. All dimensions should be real numbers (decimal numbers) and the calculated area should be displayed with 2 decimal digits. The output of your program must look like the sample output below.

For a rectangle, the program should ask for the width and the length, and calculate the area as width * length.
For a triangle, the program should ask for the height and the base and calculate the area as (height *base) /2.
For a circle, the program should ask for the radius and calculate the area as 𝜋 * radius2.

INPUT VALIDATION: All user input must be validated and the program should terminate in case of invalid input. When selecting a menu item, if the user’s input is not 1, 2, 3 or 4, the program should terminate with an error message. For room dimensions, only positive values should be accepted. If the user enters 0 or a negative value, the program should again terminate with an error message.


PointerArray 6

Write a program that does the following using pointers: -asks the user for a number of elements that should be generated. Let’s call this number n (n >0 and n<100) -allocates space for n of integers -generates n random integers (0-1000) and store in the allocated space -prints out the number of stored elements that are divisible by 5 -deallocates the memoryThe sample run may look like the following> enter the number of elements> 10> No of elements divisible by 5 is 3

Aviation Alphabet

Aviation Alphabet 7

Write a program that prompts the user for a word, and displays the word in the Aviation Alphabet:

A = alpha H = hotel O = oscar V = victor
B = bravo I = india P = papa W = whiskey
C = charlie J = juliet Q = quebec X = x-ray
D = delta K = kilo R = romeo Y = yankee
E = echo L= lima S = sierra Z = zulu
F = foxtrot M = mike T = tango
G = golf N = november U = uniform

For example, the string: “Program” should be displayed as:
papa romeo oscar golf romeo alpha mike.

Your program should include a function that uses a switch to display the Aviation Alphabet equivalent of each character (whether upper OR lower case).


NamesList 8

Write a program that asks for the user’s name, phone number, and address. The program then saves all information in a data file (each information in one line) named list.txt. Finally, the program reads the information from the file and displays it on the screen in the following format:Name: User’s Name
Phone Number: User’s Phone Number
Address: User’s Street Address
User’s City, State, and Zip Code

Chapter 1 & 2 – 3 C++ Programs

Chapter 1 & 2 - 3 C++ Programs 9

Q1: Write a program that prompts the user to enter five test scores and then prints the average test
score. (Assume that the test scores are decimal numbers.)

Q2: Write a program that prompts the capacity, in gallons, of an automobile fuel tank and the miles per
gallon the automobile can be driven. The program outputs the number of miles the automobile can be
driven without refueling.

Q3: A room has one door, two windows, and a built-in bookshelf and it needs to be painted. Suppose
that one gallon of paint can paint 120 square feet. Write a program that prompts the user to input the
lengths and widths of the door, each window, the bookshelf; and the length, width, and height of the
room (in feet). The program outputs the amount of paint needed to paint the walls of the room.

all_convert cpp

all_convert cpp 10

Write a templated function, named “all_convert”, that takes a const reference to a string and a pointer to an int. This function should convert the string to the templated type and return that. It should also adjust the int being pointed to to indicate the number of characters of the string that were converted (be sure to count leading whitespace too).You can assume that the string does not have any newline characters, and your function should ignore leading whitespace (like stoi does).

New Download