Roll the Dice, where each dice has from 1 to 6 dots on each side. Two dice will be rolled. Use the random function to generate a random integer between the beginning and ending range of dot possibilities.
Your program should generate a random number. Then display a message to prompt a player to enter his/her name and then guess the number. They have 5 chances to get the number correct. If they guess the right one, display to them that they guessed the correct number in the number of guesses. If they did not guess itin 5 attempts, display a message telling them they were not successful in guessing the correct number and tell them which number it was. Allow the player to play again.
given Java code within the link, figure out how it works.
The code is already written. You need to fix the code so it accepts *,/ and ^ operations
need to add multiplication, addition, and power
https://drive.google.com/file/d/1NoVc1HNT9kPNJhnFg0x2V44tak9C0x4c/view?usp=sharing
Modify the code following grammar.
<expr> -> <te rm> { <add op> <exPr>}
<te rm> -> <factor> { mult opp> <Term> }
<factor> -> <primary> <factor> I <primary>
<primary> -> .(. <expr> .) ' ) <factor> I identifier I number
<add op> -> '+' I ' - '
<mult op> -> ' * ' I ' / ' I %
Make sure your solution works correctly for exponents (and left associativity) for example:
4^2 = 16 and 2^3^2 = 512
Let Q denote the number of times a printer in a local library will run out of paper: 0, 1, 2, or 3 times in a given day. Let R denote the number of times the circulation desk clerk is called away from the desk. Their joint probability distribution is given in the “Joint Probability” worksheet labeled “Joint Probability” in the Excel file.
Find P(R = 2 | Q = 2). Give your answer to 3 decimal places.
A customer makes a purchase at the store. The tax rate is 8% on all purchases
except groceries. The store offers a 5% discount to seniors 60 and over. You
should ask the user three questions: what they have bought (use a menu
displaying bread, milk, or soap), what the purchase price is, and how old they are.
Your goal is to print a formatted invoice with the following line items: price, tax,
discount, and total. The discount should only be printed if applicable.
You should test your program with 5 data sets: with and without tax and with and
without the senior discount. The fifth data set makes an invalid choice of the
menu item, in which case your program should not ask any more questions and
output an error message.
Create a class employee which stores name, id and salary of an employee. Derive two [5]
classes ‘regular’ and ‘part-time’ from it. The class ‘regular’ stores TA, DA and grade-pay
and class ‘part-time‘ stores number of hours and pay-per-hour for an employee. Display
all the information for a regular and a part-time employee, using the concept of virtual
function.
For the program given below, write statements to call display function from base and
derived class in main.
class base
{
int x;
public:
base (int a){x=a;}
void display ( )
{ cout <<x<<"\n";}
};
class derived :public base
{ int d;
public:
derived (int a, int b): base (a)
{ d=b; }
void display ( )
{cout <<d;}
};
int main ( )
{ derived D(10,20);
return 0;
}
Two brackets are considered to be a matched pair if an opening bracket (i.e., (, [, or { ) occurs to the left of a closing bracket (i.e., ), ], or }) of the exact same type. There are three types of matched pairs of brackets: [], {}, and (). A matching pair of brackets is not balanced if the set of brackets are not matched.
Write a program to determine whether the input sequence of brackets is balanced or not. If a string is balanced, it prints YES on a new line; otherwise, print NO on a new line.
Example:
Input: {[()]} and Output: YES
Input: {[(])} and Output: NO
Write a program to convert an infix expression into its equivalent prefix notation.
Write a program to convert an infix expression into its equivalent postfix notation