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 Ingo U Your Own Question

Ingo U
Ingo U, Software Engineer
Category: Homework
Satisfied Customers: 486
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
44076068
Type Your Homework Question Here...
Ingo U is online now
A new question is answered every 9 seconds

Programs must run on this simulator located at: http://www.itk.ilstu.edu/faculty/gsage

Resolved Question:

Programs must run on this simulator located at:

http://www.itk.ilstu.edu/faculty/gsagers/lmc/default.htm


Write a LMC program that takes two inputs, a number to count down from, and the step value (example: count down from 35 by 5), until it reaches zero. It should print each step, and the last number before zero if the sequence doesn’t end on zero, but if the number goes to negative, that number should not be printed. Example output using 13 and 3 as inputs would be: 13, 10, 7, 4, 1. Example output using 12 and 3 as inputs would be: 12, 9, 6, 3, 0.











Write the code to calculate the area and perimeter of a triangle. The program should take 3 inputs, which are, in order, the base, height, and the third side of the triangle. The code should produce 2 values in the output box, the first number will be the area and the second, the perimeter. (Hint: you’ll probably want to use DAT statements to store some values to start).

Example code:

Calculate perimeter & area - takes L & W as inputs
prints out perimeter first, then area.
00 LDA #01;
01 STA 99;
02 IN;
03 STA 98;
04 LDA #00;
05 STA 96;
06 IN;
07 STA 97;
08 ADD 97;
09 ADD 98;
10 ADD 98;
11 OUT;
12 LDA 96;
13 ADD 98;
14 STA 96;
15 LDA 97;
16 SUB 99;
17 STA 97;
18 SKZ;
19 JMP 12;
20 LDA 96;
21 OUT;
22 HLT;


MULTIPLIES TWO NUMBERS.
00 IN;
01 STA 99;
02 STA 97;
03 IN;
04 STA 98;
05 SUB 90;
06 STA 98;
07 SKZ;
08 JMP 12;
09 LDA 97;
10 OUT;
11 HLT;
12 LDA 97;
13 ADD 99;
14 STA 97;
15 LDA 98;
16 JMP 05;
90 DAT 001;

ADDS THE FIRST NUMBER INPUT TO ITSELF,
THEN SUBTRACTS THE SECOND INPUT FROM THE TOTAL
00 IN;
01 STA 90;
02 IN;
03 STA 91;
04 LDA 90;
05 ADD 90;
06 SUB 91;
07 OUT;
08 HLT;

ONE WAY OF COUNTING FROM AN INPUT DOWN TO ZERO
00 IN;
01 OUT;
02 SUB 98;
03 SKP;
04 JMP 06;
05 JMP 01;
06 HLT;
98 DAT 002;




SQUARING A NUMBER
00 IN; take input

01 STA 99; save value as a mulitiplier

02 STA 97; save value as multiplicand

03 SUB 90; subtract one from counter

04 STA 98; copy value to counter

05 LDA 97; load our accumulator number

06 ADD 99; Add original number

07 STA 97; store intermediate sum

08 LDA 98; Load counter

09 SUB 90; subtract one from counter

10 STA 98; Store counter value

11 SKZ; skip if counter is at zero

12 JMP 05; othewise, loop back to 5

13 LDA 97; load our squared number

14 OUT; Write output

15 HLT; stop

90 DAT 01; countdown value
Submitted: 1 year ago.
Category: Homework
Expert:  Angela--Mod replied 1 year ago.

Hello, I'm a moderator for this topic. I've been working hard to find a professional to assist you right away, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're ok with continuing to wait for an answer. Please let me know and I will assist further. Thank you!

 

Best,

Angela

Customer: replied 1 year ago.

I am okay waiting for an answer as long as it gets answered by October 13th by 11:00pm

Expert:  Angela--Mod replied 1 year ago.
Thank you for your patience while we continue to search for a professional to assist you.
Expert:  Ingo U replied 1 year ago.
Hi,
for the 2nd part, it didn't state that it's a right triangle. In that case, according to my knowledge of geometry, finding the 3rd side (in order to compute perimeter) involves finding a square root, or trig functions. It seems to me that would be excessively complicated. given the nature of the assignment and limited instruction set of LMC.
Could it be that we can assume a right triangle, so the height is the third side?
Thanks,
Ingo U
Customer: replied 1 year ago.

Yes, it can be a right triangle or any type of triangle. I believe right would be the easiest to compute?

Customer: replied 1 year ago.

Ironically I just checked my e-mail and he added this to the instruction set:


 


For the triangle problem, you should assume a right triangle. The formula for area is 1/2 * b * h, and the perimeter is
b + h + 3rd side. I apologize for any confusion in my wording about "you can assume any triangle". Any triangle has the same formula for area and perimeter, but if it's not a right triangle, there's an extra step you'd need to find the height.

For the test data, I'll be using 6 for base, 8 for height, and 10 for the hypotenuse. The perimeter is 24, and the area is the same.

One last note, I am grading based on whether the code returns the right results, not on efficiency. But, for efficiency, although both 1/2*(b*h) and (1/2*b)*h yield the same answer, the second is much more efficient, especially for something like little man.

Expert:  Ingo U replied 1 year ago.
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.
Ingo U, Software Engineer
Category: Homework
Satisfied Customers: 486
Experience: Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
Ingo U and 5 other Homework Specialists are ready to help you

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:

 
 
 
  • 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
< Last | Next >
  • 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
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX
 
 
 

Meet The Experts:

 
 
 
  • Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4522
    More than 5000 online tutoring sessions.
< Last | Next >
  • http://ww2.justanswer.com/uploads/BU/BusinessTutor/2012-2-2_115741_Kouki2.64x64.jpg Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4522
    More than 5000 online tutoring sessions.
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Engineer

    Satisfied Customers:

    3458
    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • http://ww2.justanswer.com/uploads/LI/lindaus/2012-6-10_04811_IMG20120609164157.64x64.jpg Linda_us's Avatar

    Linda_us

    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    3124
    Post Graduate Diploma in Management (MBA)
  • http://ww2.justanswer.com/uploads/chooser77/2009-08-18_162025_Chris.jpg Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    2385
    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • http://ww2.justanswer.com/uploads/JawaadAhmed/2009-6-27_12137_SIs_SHadi.jpg F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    1988
    Experience with chartered accountancy
  • http://ww2.justanswer.com/uploads/JK/jkcpa/2011-1-16_182614_jkcpa.64x64.jpg Bizhelp's Avatar

    Bizhelp

    CPA

    Satisfied Customers:

    1876
    Bachelors Degree and CPA with Accounting work experience
  • http://ww2.justanswer.com/uploads/avremote/photoa.jpg Seanna's Avatar

    Seanna

    Tutor

    Satisfied Customers:

    1781
    3,000+ satisfied customers, all topics, A+ work
 
 
 
Chat Now With A Tutor
Ingo U
Ingo U
Tutor
486 Satisfied Customers
Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL