How JustAnswer Works:

  • Ask an Expert
    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
lifesaver, Computer Software Engineer
Category: Programming
Satisfied Customers: 5962
Experience:  Several years of intensive programming and application development experience in various platforms.
Type Your Programming Question Here...
lifesaver is online now
A new question is answered every 9 seconds

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

Resolved Question:

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
Submitted: 4 years ago.
Category: Programming
Expert:  lifesaver replied 4 years ago.
Hello Bamaboy,

Can you please uplaod your code to www.pastebin.com and give me the download link .

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

Visit the link below.

www.wikisend.com

Browse and uplaod the word document.

It will give you a download link.

GIve me that download link so that i can downlaod the word document/

Customer: replied 4 years ago.

Here's the download link. Thanks,

 

http://wikisend.com/download/444782/Exercise 2.docx

Expert:  lifesaver replied 4 years ago.
Ok.

GOt the word document.

Will post the answer soon.
Customer: replied 4 years ago.
Thanks!
Expert:  lifesaver replied 4 years ago.
You can download the program from link below:-

http://pastebin.ca/1612930

OR

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

Here's a link that will help you calculate gcd and verify results .
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.
lifesaver and 3 other Programming Specialists are ready to help you
Expert:  lifesaver replied 4 years ago.
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.
Expert:  lifesaver replied 4 years ago.
Take some time and verify all the outlputs.

IF any problems let me know.

I will correct the code.
Expert:  lifesaver replied 4 years ago.
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 4 years ago.
I can't get this one to work.
Expert:  lifesaver replied 4 years ago.
DO you get errors?

Please try to download from this link:-

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

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

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

Have a good day.
Customer: replied 4 years ago.
Your are the best :)
Customer: replied 4 years ago.
Hello, I have another exercise to complete Can you help? I will pay the same price. Thanks.
Customer: replied 4 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 ;

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

Expert:  lifesaver replied 4 years ago.
Same methode.

Uplaodethe word template to wikiesend.
Customer: replied 4 years ago.
Here you go. http://wikisend.com/download/519900/Exercise 1.docx
Expert:  lifesaver replied 4 years ago.
Ok.

GOt the file.I am working on it.
Customer: replied 4 years ago.
Thanks
Expert:  lifesaver replied 4 years ago.
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 4 years ago.
OK

JustAnswer in the News:

 
 
 
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.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...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
< Last | 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
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Satisfied Customers:

    5603
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/unvadim/2010-11-15_210218_avatar.jpg unvadim's Avatar

    unvadim

    Computer Software Engineer

    Satisfied Customers:

    1158
    Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Satisfied Customers:

    950
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Satisfied Customers:

    864
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/RA/rajivsharma086/2012-6-6_17128_displaypic.64x64.jpg Raj's Avatar

    Raj

    Computer Engg.

    Satisfied Customers:

    860
    BE CS, 4+ Experience in Programming and Database (ERP)
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Satisfied Customers:

    590
    11 yrs of programming (PHP, WordPress, XSL, SQL, JavaScript)