Question

In: Computer Science

Visual Basic This assessment will cover the Programming fundamentals of the Integrated Development Environment(IDE) found in...

Visual Basic

This assessment will cover the Programming fundamentals of the Integrated Development Environment(IDE) found in Chapters 1-7 of the assigned text. In this assignment, you will demonstrate the use of tools explored so far within the course. It is the High Totals Game activity found in the Case Projects section of your book. Requirements: Copy/paste the VB code into a Microsoft Word document. You are also required to submit enough screenshots of the output to show that all work has been completed.

Create an application that can be used to practice adding, subtracting, multiplying, and dividing numbers. The application should display a math problem on the screen and then allow the student to enter the answer and also verify that the answer is correct. The application should give the student as many chances as necessary to answer the problem correctly. The math problems should use random integers from 1 through 20, inclusive. The subtraction problems should never ask the student to subtract a larger number from a smaller one. The division problems should never ask the student to divide a smaller number by a larger number. Also, the answer to the division problems should always result in a whole number. The application should keep track of the number of correct and incorrect responses made by the student. The interface should include a button that allows the user to reset the counters for a different student.

The High Total game requires two players. The application’s interface should allow the user to enter each player’s name. When the user clicks a button, the button’s Click event procedure should generate two random numbers for player 1 and two random numbers for player 2. The random numbers should be in the range of 1 through 20, inclusive. The procedure should display the four numbers in the interface. It should also total the numbers for each player and then display both totals in the interface. If both totals are the same, the application should display the message “Tie”. If player 1’s total is greater than player 2’s total, it should display the message “player 1’s name won”. If player 2’s total is greater than player 1’s total, it should display the message “player 2’s name won”. The application should keep track of the number of times player 1 wins, the number of times player 2 wins, and the number of ties. The interface should also include a button that allows the user to reset the counters and interface for a new game.

Solutions

Expert Solution

int sub(int a, int b)
{
  
return a + flipSign(b);
}
  

int mul(int a, int b)
{
  
if (a < b)
return mul(b, a);
  
  
int sum = 0;
for (int i = abs(b); i > 0; i--)
sum += a;
  

if (b < 0)
sum = flipSign(sum);
  
return sum;
}
  

int division(int a, int b)
{

if (b == 0)
throw(b);
  
int quotient = 0, dividend;
  

int divisor = flipSign(abs(b));
  
  
for (dividend = abs(a); dividend >= abs(divisor);
dividend += divisor)
quotient++;
  
  
if (areDifferentSign(a, b))
quotient = flipSign(quotient);
return quotient;
}
  

int main()
{
cout << "Subtraction is " << sub(4, -2) << endl;
cout << "Product is " << mul(-9, 6) << endl;
  
try
{
cout << "Division is " << division(8, 2);
}
  
catch (int k)
{
cout << " Exception :- Divide by 0";
}
return 0;
}


Related Solutions

What do you know about the integrated development environment (IDE)? Please explain in detail. Please answer...
What do you know about the integrated development environment (IDE)? Please explain in detail. Please answer the question in text.
Steps to making your Netbeans IDE (Interactive Development Environment): Download and install Netbeans 8.2 IDE (Java...
Steps to making your Netbeans IDE (Interactive Development Environment): Download and install Netbeans 8.2 IDE (Java SE version only). If you do not have the latest Java installation to match, Netbeans will direct you to download the needed version of Java. If needed, download and install the latest Oracle Official Java Software Development Kit Standard Edition (Java SDK SE), and JUnit. I suggest you do this via the bundle referred to as The Java Development Kit (JDK). Download the architecture...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax Application 1.1 Problem Statement Due to upcoming end of financial year, you are being called in to write a program which will read in a file and produce reports as outlined. Inputs: The input file called IncomeRecord.txt contains a list of Annual income records of employees in a firm. Each record is on a single line and the fields are separated by spaces. The...
I am trying to write code for a program in Visual Studo using Visual Basic programming...
I am trying to write code for a program in Visual Studo using Visual Basic programming language that computes the factorial of an entered number by using a For Loop. My problem is that it keeps re-setting the variable for Factorial. Below is my code if anyone can help. I want it to multiply the given number by that number - 1, then continuing to do so until it hits zero without multiplying by zero. Private Sub BtnCalculate_Click(sender As Object,...
Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language...
Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language - Visual Studio 2017 RESTAURANT MENU Write a program to place an order from the restaurant menu in Table 4.13. Use the form in Fig. 4.70, and write the program so that each group box is invisible and becomes visible only when its corresponding check box is checked. After the button is clicked, the cost of the meal should be calculated. (NOTE: The Checked...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT