Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Which of the following apply to the while loop only? To the do...while loop only? To both?



a. It is considered a conditional loop.



b. The body of the loop executes at least once.



c. The logical expression controlling the loop is evaluated before the loop is



entered.



d. The body of the loop may not execute at all.

Rewrite the following expressions using an if...else statement. (Assume that all variables are declared properly.)


a. (x < 5) ? y = 10 : y = 20;


b. (fuel >= 10) ? drive = 150 : drive = 30;


c. (booksBought >= 3) ? discount = 0.15 : discount = 0.0;

2. Suppose that x, y, and z are int variables, and x = 10, y = 15, and z = 20. Determine



whether the following expressions evaluate to true or false:



a. !(x > 10)



b. x <= 5 || y < 15



c. (x != 5) && (y != z)



d. x >= z || (x + y >= z)



e. (x <= y - 2) && (y >= z) || (z - 2 != 20)



3. Rewrite the following expressions using an if...else statement. (Assume that all variables



are declared properly.)



a. (x < 5) ? y = 10 : y = 20;



b. (fuel >= 10) ? drive = 150 : drive = 30;



c. (booksBought >= 3) ? discount = 0.15 : discount = 0.0;

Create class called match; the class must have the following data members and methods:






Data Members:




•This class has two data members named HomeTeam and VisitorTeam which are of type Team, they will store that two teams that will play the Match.





Methods:




•This class doesn’t have a default constructor, it only has one constructor which receives two Team object that will be assigned to HomeTeam and VisitorTeam.




•setTeams(),which receives two Team object that will be assigned to HomeTeam and VisitorTeam.




•playMatch(), simulates match play by calling the scoreGoals methods of each team.




•getPlayGound(), returns the ground of play which is the HomeGound of the HomeTeam.




•isDrawMatch(), will return true if the Match is a draw and false if there is a winner. The match is a draw if the goals of the teams are equal. •getWinner(), returns the team which won the match, a team wins if its goals is higher than the goals of the other team.








Create a class called Match that will have team the class must have the following data members and methods:









Data Members:





• This class has two data members named HomeTeam and VisitorTeam which are of type Team, they will store that two teams that will play the Match.





Methods:





• This class doesn’t have a default constructor, it only has one constructor which receives two Team object that will be assigned to HomeTeam and VisitorTeam.





• setTeams(),which receives two Team object that will be assigned to HomeTeam and VisitorTeam.





• playMatch(), simulates match play by calling the scoreGoals methods of each team.





• getPlayGound(), returns the ground of play which is the HomeGound of the HomeTeam.





• isDrawMatch(), will return true if the Match is a draw and false if there is a winner. The match is a draw if the goals of the teams are equal.





• getWinner(), returns the team which won the match, a team wins if its goals is higher than the goals of the other team.









Which attribute is used to define the font type

Which of the following apply to the while loop only? To the do...while loop only? To both?

a. It is considered a conditional loop.

b. The body of the loop executes at least once.

c. The logical expression controlling the loop is evaluated before the loop is

entered.

d. The body of the loop may not execute at all.


Suppose that x, y, and z are int variables, and x = 10, y = 15, and z = 20. Determine whether the following expressions evaluate to true or false:

a. !(x > 10)

b. x <= 5 || y < 15

c. (x != 5) && (y != z)

d. x >= z || (x + y >= z)

e. (x <= y - 2) && (y >= z) || (z - 2 != 20)


Suppose that x, y, and z are int variables, and x = 10, y = 15, and z = 20. Determine whether the following expressions evaluate to true or false:

a. !(x > 10)

b. x <= 5 || y < 15

c. (x != 5) && (y != z)

d. x >= z || (x + y >= z)

e. (x <= y - 2) && (y >= z) || (z - 2 != 20)


Which of the following apply to the while loop only? To the do...while loop only? To both?


a. It is considered a conditional loop.


b. The body of the loop executes at least once.


c. The logical expression controlling the loop is evaluated before the loop is


entered.


d. The body of the loop may not execute at all.

LATEST TUTORIALS
APPROVED BY CLIENTS