Two players are each given a set of 3 dice. The first player throws the 3 dice and the
numbers on the top face of each die is recorded. Then the second player similarly
throws his 3 dice and the numbers on the top face of each die is also recorded. The
two sets of readings are compared and a player is deemed to have won that round if
any of the following occurs: -
(a) A set of all same numbers are obtained e.g. all 1s, or all 2s, or any other number
therein. If both players fall into this scenario during that round, then it is a draw
for that round. If only one player throws all the same numbers, then he wins
that round.
(b) Both players throw their dice and obtained three different numbers. All three
numbers are totalled up and whoever has the larger total, wins that round.
However, if the total of both players are the same then it is a draw.
After N rounds, the first player to reach a total accumulated round wins of 10 is declared
the overall winner.
write a c++ program to demonstrate hierachical inheritance to get square and cube of a number. Base class must calculate square of a number whilst Base class2 caculates cube of a numberr
Create a program that will allow user to enter an integer number and display its square root and absolute value
create a program that will display the square root and absolute value of each number that tanges 1-100
Beyond 300 units Rs.5.00 per unit
An electricity board charges the following rates to domestic users to discourage large consumption
of energy.
For the first 100 units Rs 1.50 per unit
For the next 200 untis Rs 3.00 per unit
All users are charged a minimum of Rs. 100. If the total cost exceeds Rs.250, then an additional
surcharge of 15% is added. Write a program to read the name of user and number of units consumed
and print out the charges with name.
An electricity board charges the following rates to domestic users to discourage large consumption of energy. For the first 100 units Rs 1.50 per unit For the next 200 units Rs 3.00 per unit
cause the program to print out the total cars and total cash and then exit. *3. Create a class called time that has separate int member data for hours, minutes, and seconds. One constructor should initialize this data to 0, and another should initialize it to fixed values. Another member function should display it, in 11:59:59 format. The final member function should add two objects of type time passed as arguments. A main() program should create two initialized time objects (should they be const?) and one that isn’t initialized. Then it should add the two initialized values together, leaving the result in the third time variable. Finally it should display the value of this third variable. Make appropriate member functions const
A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of 3 customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday's receipts. The program should use the function calculateCharges to determine the charge for each customer.
Write a c++ program using function that take an array of integers as input and return the
sum of number in the array.
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