Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.

Get a Professional Answer

Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

100% Satisfaction Guarantee

Rate the answer you receive.

Ask lifesaver Your Own Question

lifesaver, Computer Software Engineer

Category: Programming

Satisfied Customers: 5962

Experience: Several years of intensive programming and application development experience in various platforms.

16528259

Type Your Programming Question Here...

lifesaver is online now

I have a practice exam and I need help with exercise. See below.

This answer was rated:

★★★★★

I have a practice exam and I need help with exercise. See below. Thanks.

Exercise 2: Euclid's Algorithm Task for Exercise 2 Using the template given below and the pseudocode for Euclid's Algorithm, write a C++ program that computes the greatest common divisor (GCD) of two numbers. Remember to maintain all the blank lines, spaces, and general alignment in the template. Then replace the areas that have been highlighted in yellow with your code. Do not change any of the other code. Code Template for Exercise 2 /*******************************************************/ /* File: name of your file with the source code */ /* */ /* Created by: give your name */ /* Date: give the date */ /* */ /* Program to compute the GCD of two integers */ /* */ /* Inputs: (keyboard) */ /* 1. Two numbers - only positive numbers allowed */ /* */ /* Output: */ /* Print the GCD of given numbers on the screen */ /* */ /* Algorithm: Euclid's Algorithm */ /* */ /*******************************************************/ #include using namespace std ; int main() { Declare x, y, temp, remainder as Integer. // read in the two integers cout << endl ; cout << "Enter the first number (positive integer) : " ; cin >> x ; cout << "Enter the second number (positive integer) : " ; cin >> y ;

//echo inputs

cout << "Input numbers are: " << x << " , " << y << endl ; Write a C++ if statement to determine if x < y. { // exchange values of x and y

Write three assignment statements in C++ that are equivalent to the three statements given in the pseudocode. } /* At this point we will always have x >= y */ Initialize remainder. while ( ) { Write the loop expression and loop body code in C++. In C++, the expression (x % y) gives the remainder after dividing x by y. } // display the result cout << endl ; cout << "The GCD is: " << y << endl ; return (0); // terminate with success } Test Plan for Exercise 2 Test your code with the following pairs of numbers: x y Expected answer 1 1 2 2 5 5 20 20 2 10 10 2 3 4 4 3 36 48 48 36 90 390 252 108 1024 256 23,205 1,638

Hello, I have another exercise to complete Can you help? I will pay the same price. Thanks.

Customer:replied 7 years ago.

Here's the exercise. Thanks.

Exercise 1. Course Grade

Task for Exercise 1

Suppose that a float variable called score contains the overall points earned for this course. The following set of cascaded if-then-else pseudocode statements determines your final grade.

If (score >= 85) then Set grade = ‘A' Else If (score >= 75) then Set grade = ‘B' Else If (score >= 65) then Set grade = ‘C' Else If (score >= 55) then Set grade = ‘D' Else Set grade = ‘F' End if // score >= 55 End if // score >= 65 End if // score >= 75 End if // score >= 85

Your assignment is to convert this pseudocode into a C++ program. Use the following template for your program and remember to maintain all the blank lines, spaces, and general alignment. Then replace the areas that have been highlighted in yellow with your code. Do not change any of the other code.

Code Template for Exercise 1

/****************************************************/ /* File: name of your file with the source code */ (Highlighted in yellow) /* */ /* Created by: give your name */ /* Date: give the date */ /* */ /* Program to determine course grade */ /* */ /* Inputs: (keyboard) */ /* 1. Float - weighted total points (<= 100) */ /* */ /* Output: */ /* letter grade using pseudocode grading policy */ /* */ /* Algorithm: Comparisons using if-then-else */ /* */ /****************************************************/ #include <iostream>

using namespace std ;

int main() {

Declare score and grade appropriately as variables. (Highlighted in yellow)

// read in total score

cout << endl ; cout << "Enter total score (float, must be <= 100) : " ; cin >> score ;

Write C++ if-then-else statements to determine course grade, using the grading policy stated in the pseudocode. (Highlighted im yellow)

// display the result

cout << endl ;

cout << "Your grade for CMIS 102 is: " << grade << endl ;