Anda di halaman 1dari 4

CS11 Introduction to Computer Science

Assignment 06 SmallBasic Question



Preparatory Installing SmallBasic software (if you hadnt done so).
Task

A document called InstallingSmallBasic.pdf is in the Documents folder
(under Resources folder) explains how to install SmallBasic software.

Writing sample Smallbasic program.

In the document IntroducingSmallBasic.pdf, you should try to create
and run the following programs.

a)
Using of WriteLine to print output (see page 4).
b)
Entering your name from the keyboard (see page 11)
c)
Adding 2 numbers with their values already set (see page 13(
d)
Converting value for Fahrenheit (read from the keyboard) to
Celsisus (see page 14).



Task 1

Write program in SmallBasic such that it will prompt the user to enter
a value in Celsius degree, and then convert this value to Fahrenheit
degrees.

Use the formula: fahrenheit = celsius*9/5 + 32


After computing the Fahrenheit, display a meaningful message for the
user. Your output should be like this:

Your output should be like this:



Enter value for celsius: 100

100 degrees Celsius equals 212 degrees Fahrenheit.


Hint: Converting from Fahrenheit to Celsius is given in the SmallBasic
tutorial document (see page 14) but the one above is converting from
Celsius to Fahrenheit.


That is, if you scroll down to page 14 of the said document, you will see this.

Now, if you copy the code above from the document, and paste it to SmallBasic and
with a little bit of editing, you should have something like this.


Now if you press the Run Button

, you will get this output.

And if you enter 212, then press Enter, you will get this output.


Now, the question above required you to do the same problem but this time, you
will prompt the user to enter a value for Celsius and then convert this value to
Fahrenheit.

Now do your work!

For submission of work, take screenshot of your source code + output and paste it
to a Word document and label clearly that is for Task 1.


Continue next page




Task 3

Modify program in question 1 such that if the value calculated for


Fahrenheit is more than 212 then display message More than boiling
point of water else display message Less than boiling point of
water


Here are two different sample outputs:


Enter value for celsius: 120

120 degrees Celsius equals 248 degrees Fahrenheit.
More than boiling point of water.




Enter value for celsius: 80

80 degrees Celsius equals 176 degrees Fahrenheit.
Less than boiling point of water.



HINT : On page 15 of the document Introducing Small Basic.pdf gives
tutorial on how to ask a question and get result using the If
keyword (with a Clock variable).

In addition, the program on page 17 uses the if-else statement for
testing if a number is even or odd.

Remember this time you are asking to test the value of celsius
entered from the keyboard.

Now do your work!

Take screenshot of your source code + output and paste it to same
Word document used before and label clearly that is for Task 2.



For submission.

Convert your Word document to pdf then submit it via Etudes as work for this
question.
Submit your pdf file via Etudes.

Anda mungkin juga menyukai