Skip to main content
Engineering LibreTexts

7.5: Problems

  • Page ID
    76129
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    1. In the file conversions.s you will implement three functions.

    a. The first is k2m, which will convert kilometers to miles by multiplying by 10 and dividing by 16.

    b. The second function is mph(int miles, int hours), which will calculate miles per hour by dividing miles (in r0), by hours (in r1), and returning the value in r0.

    c. The third function is mph(it kilometers, int hours), and MUST be calculated by converting the kilometers to miles using the function k2m, and then calling mph().

    Create a main method in a separate file that will call the kph and mph functions to test them. The function must allow a value to be entered for distance and time in both cases, and print out an answer. You must create good code, including good comments on the methods, and well formatted code.

    2. Write the functions CtoF and InchesToFt and add it to the conversions.s file. Write a main program to call it and test it. (40 points) For the InchesToFt,

    3. Convert the InchesToFt so it uses implied decimals when converting inches to feet. For example, 14 inches would be 1.16 feet.

    4. Create a class Money that you will implement as an integer with two implicit decimal point accuracy. Show it works by reading in Money values from a user, and implemented addition, subtraction, multiplication, and division, and printing valid output as $NNN.NN.

    What you will learn. (Chapter 8)

    In this chapter you will learn:

    1. why goto statements exist in languages

    2. how to create logical (or Boolean) variables in assembly

    3. the basic control structures used in structured programming, and how to translate them into assembly code; the basic control structures covered are:

    3.a if statements

    3.b if-else statements

    3.c if-else if-else statements

    3.d sentinel control loops

    3.e counter control loops

    4. calculating branch addresses


    This page titled 7.5: Problems is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Charles W. Kann III via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?