Questions
I want to make the Main function of this program to only drive. So, make more...

I want to make the Main function of this program to only drive. So, make more functions, and change main function to just drive.

This program Dice Game.

Based on this C++ program below:

#include <iostream>
#include <cstdlib>

using namespace std;

int cheater(int computer, int user){
   cout<<"Using cheat"<<endl;
   if(computer>user)return computer+rand()%2;
   if(computer==3 || computer==18)return computer;
   if(user>computer)return computer -1;
}

int main()
{
int user, computer,sum,u_diff,c_diff,u_win=0,c_win=0;
int gameCount=0;
bool enableCheat=false;
int lastGameWon=0;
do
{
cout<<"User guess is(1 - 18) :";
cin>>user;
if(user>=3&&user<=18) //the sum of three dice should be between 3 to 18
{
   gameCount+=1;
cout<<"Computer guess is :";
computer=rand()%16+3;
cout<<computer<<endl<<"User guess is : "<<user<<endl;
cout<<"Sum of the three rolls is :";
sum=rand()%16+3; //rand()%16 will generate the random number between 0 to 15.
if(enableCheat)sum=cheater(computer,user);
cout<<sum<<endl;
u_diff=user-sum;
c_diff=computer-sum;
if(u_diff<0){
u_diff=u_diff* -1; //u_diff,c_diff is the diffence and it should always be positive.
}
if(c_diff<0){
c_diff*=c_diff* -1; //if u_diff or c_diff is negetive than we make it positive.
}
if(u_diff<c_diff){

cout<<"user won\n";
u_win++;
if(lastGameWon+1==gameCount)enableCheat=true;
lastGameWon=gameCount;
} else{
cout<<"computer won\n";
c_win++;
enableCheat=false;
}
cout<<"User won: "<<u_win<<" times.";
}else if(user >= 19 || user <= 0){
cout<<"please enter between 1 to 18\n";
}
}while(user!=-1);
return 0;
}

In: Computer Science

A firm sells its product to two groups of customers. Demand from group 1 is Q1...

A firm sells its product to two groups of customers. Demand from group 1 is Q1 = 100, 000− 5,000P and demand from group 2 is Q2 = 140,000 − 10,000P.

a) Find the total demand that the firm faces for its product. Explain it first using pictures, and then do the algebra. Write your answer of the total demand as quantity as a function of price. (Hint: draw pictures. Then add the two demands horizontally; that is, at each price add the quantities demanded in both locations at that price)

b) Express your answer as price as a function of quantity.

In: Economics

Monique was previously married but is currently divorced. In 2017, prior to the divorce, her ex-husband...

Monique was previously married but is currently divorced. In 2017, prior to the divorce, her ex-husband received a distribution from his pension plan in the amount of $250,000. When it came time to file their taxes, Monique asked about the distribution and was told by her husband that he had consulted with a CPA and was told that because part of the funds were used to pay off a mortgage there was no taxable income to report. With this information, Monique signed the joint tax return that her husband had prepared omitting the $250,000 distribution. The divorce is now final, and Monique has received a letter from the IRS indicating that no tax return was received. Apparently, her ex-husband never filed the 2017 joint tax return. Monique has hired you as her new CPA and wants your advice on what steps she should take in response to the IRS notice. She has provided you with a copy of the tax return that includes the signatures of herself and her ex-husband. Should you advise her to file that tax return? If not, what are some of the other possible steps that Monique can take to resolve the IRS problem? What other information do you think you might get from Monique and/or the IRS before making a recommendation? Please reply to at least one of the posts by another student. Replies are part of the grade for the discussion assignments. Please see the Discussion Rubric posted in the General Information module.

In: Accounting

Given that Mary is the landlord of a Hong Kong property. The flat has been successfully...

Given that Mary is the landlord of a Hong Kong property. The flat has been successfully rented out to a tenant from 1st April 2018. Her husband provides below background information for Mary to compute her Hong Kong property tax computation. Mary fully trusts her husband and will use the below information for her Hong Kong property tax computation. The background information is as below:

Yearly rent receivable HK$ 120,000

Premium received HK$ 9,600

Repairs borne by tenant HK$ 600

Rate by owner (per quarter) HK$ 300

Rate by tenant (per quarter) HK$ 200

Statutory allowance 0%

Tax rate 6%

Rental year from 1st April Year 2

Her husband reminds Mary that the rate can be fully deductible and the premium is regarded as a fully deductible item in a particular year of assessment. Required:

a) Discuss Mary’s Hong Kong property tax computation including the discussion of taxable and deductible items for the year of assessment of 2019/20 if Mary prepares it based on her husband approach.

b) Based on the above information, justify whether the information provided by her husband is correct or not, and state the correct treatment for any incorrect information.

c) Discuss any issue related to tax administration for the case of Mary and any possible consequences Mary may face if she submits her property tax return based on (a) answer.

In: Accounting

Yasmin divorced her husband in 2018. In 2019, she maintains a home in which he and...

  1. Yasmin divorced her husband in 2018. In 2019, she maintains a home in which he and her

10-year-old son live. Her ex-husband pays child support to her that she uses to provide all of the support for the child.

Who is entitled to claim the child as a dependent? Explain whether each test has been met

or not.

In: Accounting

Consider the three stocks in the following table. Pt represents price at time t, and Qt...

Consider the three stocks in the following table. Pt represents price at time t, and Qt represents shares outstanding at time t. Stock C splits two-for-one in the last period.

P0 Q0 P1 Q1 P2 Q2
A 100 100 105 100 105 100
B 60 200 55 200 55 200
C 120 200 130 200 65 400


Calculate the first-period rates of return on the following indexes of the three stocks: (Do not round intermediate calculations. Round your answers to 2 decimal places.)

a. A market value–weighted index



b. An equally weighted index

In: Finance

If all you had were the results from the RAND health insurance experiment, what policy recommendations...

If all you had were the results from the RAND health insurance experiment, what policy recommendations would you make concerning the provision of health insurance? Explain. How certain would you be of your conclusions?

In: Economics

Hi, I want to programm a c++ gamr without the using of any array. only by...

Hi, I want to programm a c++ gamr without the using of any array. only by using FUNCTIONS, WHILE LOOPS, FOR LOOPS, IF ELSE, SRADN() and RAND(), BREAK STATEMENT, CIN and COUT. Please help me out.

In: Computer Science

Question 4 (attribution rule) Martha purchased 10,000 common shares in 2010 of SENEDGE INC, a CCPC...

Question 4 (attribution rule)

Martha purchased 10,000 common shares in 2010 of SENEDGE INC, a CCPC at $12 per share. Martha gifts her husband 5000 shares and her 14 year old daughter 5000 common shares in 2012, when the common share FMV was $13. Near the end of Dec 2015, SENEDGE INC gave out dividends $1 for each share. The husband and daughter both sell all their shares in 2016 at $16 Determine the taxable income to each individual for each case, write nil if zero

A) Common shares gifted

B) Dividends received 2015

C) Shares sold at 2016

A) Martha Husband Daug hter

B)

C)

In: Accounting

Good Quantity Price 2016 Price 2017 Price 2018 A 160 $2.00 $2.40 $2.50 B 100 $3.00...

Good

Quantity

Price 2016

Price 2017

Price 2018

A

160

$2.00

$2.40

$2.50

B

100

$3.00

$3.20

$3.10

C

20

$100.00

$110.00

$120.00

  1. Calculate the cost of living for each year.
  2. Calculate the CPI for each year taking 2016 as the base year.
  3. Calculate the inflation rate for each year.

In: Economics