HW1 EX6
You cannot submit for this problem because the homework's deadline is due.
Background
In Great Britain and Ireland human body weight is often measured in stones. A stone is defined as 14 pounds or 6.35 kg. Write a MATLAB script converting from stones to pounds, from pounds to kg and from kg to stones.
Description
Given a vector and the type of conversion, return the converted vector.
Format
Input
Two lines containing (i) a list of values and (ii) the expected conversion (e.g. [ 3.14 6.28 9.42 ] on the first line and stones to pounds on the second one.
Output
A vector containing the result of the conversion.
Sample
Input
[ 1 2 3 ]
kg to stones
Output
0.1575 0.3150 0.4724
Limitation
20s, 1024MiB for each test case.
Hint
For the first line of input, simply use the input()
function to read in the vector. Matlab will do the job for you, you don't need to handle the brackets as well as extra spaces or formats.
Usd disp()
to output your result vector. No need to add any extra format. Due to the special settings of Matlab on JOJ, you don't need to worry about the format of this exercise. You only need to check the correction of the conversion.
Also you don't need to worry about the precision of the output, just leave it to Matlab.
Homework 1
- Status
- Finished
- Problems
- 2
- Open Since
- 2019-09-15 00:00
- DDL
- 2019-09-27 23:59
- Extension
- 24.0 hour(s)