At KWT College of Education, students pay R3500 for a module and they are allowed to register for a
minimum of two and a maximum five modules per semester. In order for students to register they must
pay at least a minimum registration fee of R2000. The remaining amount must then be paid in four equal
payments at the end of March, April, May and at the end of June.
Write a C++ program that will help determine the amount payable by doing the following:
Declare all constants and necessary variables.
Prompt the user for the student number or XXX to exit (see Figure 3.1).
Determine if the number of subjects entered is valid by making use of a pre-test loop.
o If a valid student number is entered, do the following:
Prompt the user for the number of modules and the registration fee as shown in
Figure 3.2.
Validate the number of modules and the registration fee using the
Write a C++ program that computes the product of two square matrices using a two-dimensional array in C++.
SAMPLE OUTPUT:
Enter matrix 1
1
2
3
4
5
6
7
8
9
Enter matrix 2
9
8
7
6
5
4
3
2
1
Product of matrix 1 and matrix 2 is
30
24
18
84
69
54
138
114
90
Create an array of user-defined size. Fill this array with random numbers (Auto Generated). Create a menu from 1 to 6 to perform an operation on the array. As the option is selected, it calls a function with appropriate parameters and return type.
1. Average of all values.
2. Print the array
3. Find the minimum
4. Find maximum
5. Search a number
6. Print the array in reverse order
Write a C++ program that computes the sum of two square matrices using a two-dimensional array. Generate random values using the rand () function.
SAMPLE OUTPUT:
matrix 1
1
2
3
4
5
6
1
2
3
matrix 2
3
4
5
8
7
6
9
10
11
Sum of matrices is
4
6
8
12
11
12
10
12
14
Write a C++ program that computes the sum of two square matrices using a two-dimensional array. Generate random values using the rand () function.
SAMPLE OUTPUT:
matrix 1
1
2
3
4
5
6
1
2
3
matrix 2
3
4
5
8
7
6
9
10
11
Sum of matrices is
4
6
8
12
11
12
10
12
14
Write a program that reads two arrays from the user of the same size:
Lab_Marks: contains double numbers representing the students’ lab marks
Absences: contains integer numbers representing the total absences for each student.
Compute the Result (and save in another array of same size of double data type) by subtracting Absences from the corresponding element in Lab_Marks
Sample output is here:
Lab_Marks
78.0
90.0
55.5
85.7
99.0
Absences
5
3
2
0
3
Result
73.0
87.0
53.5
85.7
96.0
Write a C program that accepts a positive integer n and a real number x from the keyboard
and prints out the sum of the n terms of the series
sin(x) = X∞
n=0
tn, tn = (−1)n x
2n+1
(2n + 1)!
Write a program that takes values of a 2D array of 3x3 size and prints the array in matrix form. Like:..
An array of 3x3 size :
4
6
8
12
11
12
10
12
14
(a) Write a program which will ask the user how many symbols to output, and then output that many lines of symbols (one symbol on each line). To start, use the '*' symbol. (1K)
(b) Write a program which will ask the user how many symbols to output, and then it will output that many symbols on one line. To start, use the '*' symbol. (1K)
For example, if the user enters 5, the output would be:
*****
(c) Output the user's number as well as the symbols, all on the same line. For example, if the user entered a value of 10, the output would be: (1K)
10 **********
(d) Modify your program to allow the user to choose a symbol as well. (1K)
Number of symbols? 7
Symbol to use? @
7 @@@@@@@
(e) Allow the user the specify the total number of symbols and how many to print on each line.
For example, if the user entered 10 symbols with 4 per line, the output might be: (2T)
$$$$
$$$$
$$
(the last line only has two symbols because we only print 10 total)
'''
symbol = '*'
numOfSymbols = int(input("how many symbols do you want: "))
#A)
for count in range(numOfSymbols):
print(symbol)
#B)
print(symbol*numOfSymbols)
#C)
'''
(a) Output the times-tables (from 1 to 12) for whichever number the user requests. For example, if the user enters 3, your output should be: (1K)
1 x 3 = 3
2 x 3 = 6
...
12 x 3 = 36
Extension:
(b) Allow the user to specify the start and end to the table (e.g., 4 to 15); (2K)
(c) Allow the user to specify the step size (e.g., by 3 is 4, 7, 10, 13). (2T)
'''