• 100% Satisfaction Guarantee

lifesaver, Computer Software Engineer
Category: Programming
Satisfied Customers: 5962
Experience:  Several years of intensive programming and application development experience in various platforms.
16528259
lifesaver is online now

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

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

Exercise 2: Euclid's Algorithm
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:
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 Bamaboy,

Customer: replied 6 years ago.
I can upload a word doc with what needs to be change highlighted in yellow. Is that ok?
That's fine..
Customer: replied 6 years ago.
Can I send the word doc. to you by email or some other way? Thanks.
Sorry exchange of personal information is against site rules .

www.wikisend.com

Browse and uplaod the word document.

Customer: replied 6 years ago.

Ok.

GOt the word document.

Customer: replied 6 years ago.
Thanks!

http://pastebin.ca/1612930

OR

http://www.mediafire.com/?dyzrjwqmy2m

http://javascript.internet.com/math-related/gcd-lcm-calculator.html

Let me know if any complications arise.

lifesaver, Computer Software Engineer
Category: Programming
Satisfied Customers: 5962
Experience: Several years of intensive programming and application development experience in various platforms.
I haven't checked all the values.Just checked for 2 or 3 values.'

I am currently checking for all the values as mentioned in the word document.
Take some time and verify all the outlputs.

IF any problems let me know.

I will correct the code.
Hi,

I rechecked the program and the program gives wrong output for few cases,

Here is the perfect program.

http://pastebin.ca/1613172

Checked and it Gives correct output for all the cases.Please modify your program.

Edited by lifesaver on 10/11/2009 at 6:53 PM EST
Customer: replied 6 years ago.
I can't get this one to work.
DO you get errors?

http://www.mediafire.com/?4dmztdnmzzu

Customer: replied 6 years ago.
Thanks this one works perfect. You are my hero!
You are welcome.

I even tested it with all the test cases inside your word document.

Have a good day.
Customer: replied 6 years ago.
Customer: replied 6 years ago.
Hello, I have another exercise to complete Can you help? I will pay the same price. Thanks.
Customer: replied 6 years ago.

### Here's the exercise. Thanks.

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
If (score >= 75) then
Else
If (score >= 65) then
Else
If (score >= 55) then
Else
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: */
/* */
/* Algorithm: Comparisons using if-then-else */
/* */
/****************************************************/
#include <iostream>

using namespace std ;

int main()
{

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

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 ;

return (0); // terminate with success
}

#### Test Plan for Exercise 1

Test your code with the following numbers:

85.0, 65.0001, 54.99999, -33.3, 100, 90, 150

Same methode.

Uplaodethe word template to wikiesend.
Customer: replied 6 years ago.
Ok.

GOt the file.I am working on it.
Customer: replied 6 years ago.
Thanks
Can you open this as a new question?

Mention "to lifesaver" on top of the question to direct the question to me.

ALso please note that we receive more payment from thebonus you leave.SO please consider that fact.Can't mention the reates.

SO you may open the question for a low price but the more bonus you add ,more we ge paid.

Thanks.IF you face any problem we can continue here.
Customer: replied 6 years ago.
OK

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

### What Customers are Saying:

• My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Previous | Next >
• My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
• Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
• This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
• Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
• I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
• Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
• Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland

• ### ATLPROG

#### Satisfied Customers:

7671
MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >

### ATLPROG

#### Satisfied Customers:

7671
MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

### LogicPro

#### Satisfied Customers:

6535
Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

#### Satisfied Customers:

1168
Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

### lifesaver

#### Satisfied Customers:

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

### ehabtutor

#### Satisfied Customers:

931
Bachelor of computer science, 5+ years experience in software development, software company owner

### TheDoctor

#### Satisfied Customers:

893
M.S. in Internet Information Systems

### The-PC-Guy

#### Satisfied Customers:

682
Extensive Knowledge in PHP, MYSQL, CSS & Javascript