Write a program that prints integers that are multiples of 5 in the range of 5 to 50. Name the program as follows: multiples_while.cpp. while loop program
Write a script called Student.sh that will accept the following student details: studentID, StudentName, ContactNo and Email. The program should add records to a file called Student_Details.txt under each heading, at the end of each record the program should prompt you if you want to add more records and if yes it should allow you to continue adding the records.
QUESTION 2 (THEORY AND PRACTICAL) (30 MARKS)
Melokuhle is a very young intelligent and adventurous individual. He has recently
bought 4 quantums (taxi) to transport people around the country. As a result, he is
planning a trip to Upington.
Therefore, he has hired you to write a program in pseudocode as well as in C++ to
evaluate the fuel consumption on his 4 cars during the planned trip. The kilometers
and fuel level in the tank at the start and end of the journey should be entered by the
end-user.
Calculate for each car, the fuel used, kilometers traveled, and the overall fuel
consumption in kilometers traveled per litre of fuel.
NB write an algorithm and a code in C++
Create an algorithm for a program that enables the user to enter the career choice, name, age, education background and a search button to help match their career paths
Create an algorithm r a screening program that enables the user to check their health status by entering their name, age and blood type for life-expectancy purposes
Create an algorithm for a program where the political-administrative is decentralized. The program should enable the public to choose person for for office by entering their name, position and an option box to tick yes or no to accept the candidate
1. Determine the exact output that is produced when the following code is executed. (7)
for x = 1 to 10 step 1
for y = 1 to x step 1
if y MOD 2 = 0 AND x MOD 2 <> 0 || y MOD 2 <> 0 AND x MOD 2 = 0 then
display "*"
else
display "#"
endif
next y
display " " ~newline
next x
2. Rewrite the following for-loop as a pre-test while-loop. (6)
for x = 1 to 10
for y = 10 to x
if y MOD 2 = 0 then
display "*"
else
display "#"
endif
display " " ~newline
3. Rewrite the following for-loop as a post-test do-loop. (5)
for x = 20 to -20 step -3
display "x = ", x
next x
4. Identify an error in the following pseudocode: (2)
sum = 0
for x = 1 to 10
if y MOD 2 = 0
display y
sum = sum + y
Rewrite the following for-loop as a pre-test while-loop. (6)
for x = 1 to 10
for y = 10 to x
if y MOD 2 = 0 then
display "*"
else
display "#"
endif
display " " ~newline
Write a pseudocode algorithm for the problem
JamEx Limited requires a program to calculate and print the commission received by a salesperson. The program should process an undetermined number of salespersons and appropriately terminate by a predefined input. The commission rate is based on two factors, the amount of sales and the class to which a salesperson belongs. The input will be the salesperson number, sales amount and class. The commission rate will be based on the following criteria:
Class=1
If sales is equal to or less than $1000, the rate is 6 percent.
If sales is greater than $1000 but less than $2000, the rate is 7 percent.
If the sales is $2000 or greater, the rate is 10 percent.
Class=2
If the sales is less than $1000, the rate is 4 percent.
If the sales is $1000 or greater, the rate is 6 percent.
Class=3 The rate is 4.5 percent for all sales amount
Class=any other value
Output an appropriate error message.
Solve the following problem by showing the design of your solution as an algorithm.
The problem – The program will take two integers from the user, say n1 and n2. It will then print the sum of all numbers between n1 and n2, inclusive. For example, if the user enters 5 and 9, the program will print the value of 5+6+7+8+9. On the other hand, if the user enters 5 and -2, the program will print the value of 5+4+3+2+1+0+(-1)+(-2). Note: Do not assume the user will always enter the smaller number first.