Difference between revisions of "CSC231 Homework 3 Fall 2017"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- <bluebox> This assignment is due on Monday 10/9/17 at 11:55 p.m. You can work on this assignment in pairs, in which case you must include both your names in the ...")
 
(Assignment)
Line 10: Line 10:
 
<br />
 
<br />
 
* Using the 231Lib.asm library, write an assembly language program that prompts the user for an integer (positive) number of seconds, which it then translates in a number of days, hours, minutes and seconds.
 
* Using the 231Lib.asm library, write an assembly language program that prompts the user for an integer (positive) number of seconds, which it then translates in a number of days, hours, minutes and seconds.
 +
* Call your program '''hw3.asm'''.
 
* The format of your output should be similar to the format illustrated in the examples shown below.   
 
* The format of your output should be similar to the format illustrated in the examples shown below.   
 
<br />
 
<br />
Line 36: Line 37:
 
   
 
   
 
<br />
 
<br />
 +
 
==Additional Information==
 
==Additional Information==
 
<br />
 
<br />

Revision as of 17:27, 1 October 2017

--D. Thiebaut (talk) 17:26, 1 October 2017 (EDT)


This assignment is due on Monday 10/9/17 at 11:55 p.m. You can work on this assignment in pairs, in which case you must include both your names in the header of the assembly language program you submit. Both members of a pair must submit a program and answer the quiz.


Problem 1


Assignment


  • Using the 231Lib.asm library, write an assembly language program that prompts the user for an integer (positive) number of seconds, which it then translates in a number of days, hours, minutes and seconds.
  • Call your program hw3.asm.
  • The format of your output should be similar to the format illustrated in the examples shown below.


cs231a@aurora ~/ $ ./hw3sol 
> 1
0 days 0 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ ./hw3sol 
> 0
0 days 0 hours 0 minutes 0 seconds 
cs231a@aurora ~/ $ ./hw3sol  
> 3601
0 days 1 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ ./hw3sol 
> 8641
0 days 2 hours 24 minutes 1 seconds 
cs231a@aurora ~/ $ ./hw3sol  
> 86401
1 days 0 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ 864001
864001: command not found
cs231a@aurora ~/ $ ./hw3sol  
> 864001
10 days 0 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ 


Additional Information


  • Use the DIV instruction
  • Do not worry about whether words should be singular or plural. We do not know how to test quantities yet. Make your program output all the words in their plural form.
  • Make your program output all the quantities on one line.
  • You can use WolfranAlpha to convert seconds to day/hours/minutes/seconds, to test your program. WolframAlpha will correctly understand what to do if you enter something like "864001 seconds" in the search bar.


Submission


  • Document your program well, and submit it on Moodle, in the Homework 3, Problem 1 section. Be careful as Moodle gives only 5-minute increments for the closing time, which means you have until 11:55 p.m. on Monday to submit the program.


Problem 2


  • Answer the quiz on Moodle, in the Homework 3 Problem 2 section.