Description
CSE1341 – Lab #1
PRE-LAB [10 points]
Must be done prior to your lab session.
All: To use java and javac from the command line
Mac: Spotlight: Terminal
Windows*: Start->Run… and enter cmd
All operating systems: Type the program below into a file name “FirstProgram.java” using Notepad (Windows) or TextEdit (Mac) and compile it using javac in the Windows CMD window / or Mac Terminal window. Execute it using the “java” command in the Windows CMD window / or Mac Terminal window. Mac users – see the note at the end of this document regarding settings in the TextEdit app.
If this compiles and executes correctly your installation of Java was successful. If you experience problems, bring your laptop to the lab and ask for help.
LAB – Syntax Errors and Productivity Software [90 points]
1) [10 points] Start with the program you typed and compiled. Remove the two semi-colons (;) and try to compile your program. Paste the program and the error message into a word/open office document and explain what this message means.
2) Create a spreadsheet with solutions to the following four algorithm problems:
2a) [20 points] – The Fibonacci sequence is a pattern of integers starting with zero and one, where each subsequent value is equal to the sum of the prior two values:
Fn = Fn-1 + Fn-2, where F0 = 0 and F1 = 1.
Create a spreadsheet which contains the first two numbers of the Fibonacci sequence, and calculates each the next 25 values:
2b) [20 points] – World Population
2c) [20 points] – Customary unit conversion.
Create a spreadsheet that converts the following:
1. Liter to gallon
2. Gallon to liter
3. Kilometers to miles
4. Miles to kilometers
The conversion formulas:
1 liter = 0.264172 gallon
1 gallon = 3.78541 liters
1 kilometer = 0.621 mile
I mile = 1.609 kilometers
Use the following sample data in your spreadsheet – for grading purpose.
2d) [20 points] – Compound Interest Calculator
The formula for annual compound interest, including principal sum, is:
A = P (1 + r/n) (nt)
Where:
A = the future value of the investment/loan, including interest
P = the principal investment amount (the initial deposit or loan amount) r = the annual interest rate (decimal)
n = the number of times that interest is compounded per year t = the number of years the money is invested or borrowed for
Assume you put $120,000 into a bank. How much will your investment be worth after 15 years at an annual interest rate of 4% compounded quarterly? How much will be the total interest earned?
Submit the document and spreadsheet via Canvas (as a single zip-file).
Additional Note for Mac Users:
The TextEdit app must be set up for plain text with no smart quotes to properly create and save a document that the compiler can read. Before starting, open preferences in TextEdit and make sure the settings match the following:
Also, make sure the Format menu shows Make Rich Text as its third item. If it says Make Plain Text, click it to set it to plain text mode.




Reviews
There are no reviews yet.