Write a C++ program to implement a three-player dice game with the following rules:
1. Begin with Player A and roll two dice: dice d1 and dice d2.
2. If the sum of the two dice is odd, then accumulate it as the score of Player A. If even, then the score is 0.
3. Then roll d1 and d2 for Player B.
4. If the sum of the two dice is odd, then accumulate it as the score of Player B. If even, then the score is 0.
5. Then roll d1 and d2 for Player C.
6. If the sum of the two dice is odd, then accumulate it as the score of Player C. If even, then the score is 0.
7. Repeat steps 1 to 6 for n rounds, where n is a positive integer provided as input by the user.
Things to keep in mind:
1. You have to implement three classes, namely Player class, Dice class, and Game class, and a driver program test class that contains the main function.
2. Function in the driver program is: i) Method: int main(). It is the main method in which an object of class Game is created and the method play() is invoked.
Q1) write a simple program in c++ to calculate
1. The circumference of a circle
2. Area of a triangle
3. Area of a square
Q2) write a simple program in c++ to calculate the salary of an employee where by the basic salary will be entered by the user and other allowance as constant.
The following are the other allowance
1. dressing allowance 30% of basic
2. Fuel allowance 20% of basic
3. Maintenance allowance 30% of basic
4. SSNIT allowance 10% of basic
5. Rent allowance 40% of basic
Calculate your gross salary
Create a java program that initialize a two dimensional array with the continuous assessment marks used to determine the semester mark for PRG510S exam qualification, The system should also create an array of student names in correspondence to the marks (Note: the appropriate weights of each individual assessment are given under corresponding headings and both the marks and student names are read from the user input).
Students in Computer Science would like to understand the concept of Ohm’s law. You are required to write an application that will allow them to calculate the relation between Voltage, Current and Resistance using the formulas below.
V = IR, Current (I) = V/R, Resistance= V/I, (where I is the current, V - Voltage and R is the resistance). The program must do the following:
Prompt the user for the calculation he/she would like to see or N/n to exit .
Based on the option selected by the user (I/I, V/v, R/r),
If an invalid option is selected an appropriate error message must be displayed.
NB: Use a switch for the selection If there are no calculations to performed, display a summary that consist of the number of calculations performed. This number must exclude the invalid options,
Write an algorithm that will accept the following for 100 students: The students’ name (studName) and 3 test marks (marks), as well as one exam mark (examMark). The program must calculate the final mark (finMark) for every student. The final mark comprises of 50% of the exam mark added to 50% of the average (agv) of the 3 tests. Display the final mark for every student.
1.Mix the for loop with a do-while
Write an algorithm that will accept the following for 100 students: The students’ name (studName) and 3 test marks (marks), as well as one exam mark (examMark). The program must calculate the final mark (finMark) for every student. The final mark comprises of 50% of the exam mark added to 50% of the average (agv) of the 3 tests. Display the final mark for every student.
1.Use a nested for loop to determine the answer.
Write an algorithm that will accept the following for 100 students: The students’ name (studName) and 3 test marks (marks), as well as one exam mark (examMark). The program must calculate the final mark (finMark) for every student. The final mark comprises of 50% of the exam mark added to 50% of the average (agv) of the 3 tests. Display the final mark for every student.
1. Use a simple for-loop to determine the answer.
The user must enter a positive integer between 5 and 15. If this number is valid, the user must also choose between a triangle (T or t) and a square (S or s). Display suitable error messages if necessary; otherwise, the program must use an asterisk to draw a triangle or a square of the chosen size and display. Use a Select Case structure to make the decision. Display appropriate error messages where applicable.