1
COLLEGE OF ENGINEERING AND APPLIED SCIENCES
DEPARTMENT OF COMPUTER SCIENCE
ICSI201 Introduction to Computer Science
Project 01 Created by Qi Wang(Click here for the recording.)
Table of Contents
Part I: General project information ……………………………………………………………………………………… 02
Part II: Project grading ru
ic……………………………………………………………………………………………….. 03
Part III: Examples on How to complete a project from start to finish ………………………………… 04
Part IV: Project description ………………………………………………………………………………………………….. 09
https:
albany.zoom.us
ec/share/efWqyqGRbMxB3zeJaum-JWmFmXI5n2XngLXcr0GTsL7uRMBftfkCPT7oSjeLXQf3.aU62HLlPh8HatH8W?startTime= XXXXXXXXXX
2
Part I: General Project Information
• All projects are individual projects unless it is notified otherwise.
• All projects must be submitted via Blackboard. No late projects or e-mail submissions or hard copies
will be accepted.
• Two submission attempts will be allowed on Blackboard. Only the last attempt will be graded.
• Work will be rejected with no credit if
ï‚§ The project is late.
ï‚§ The project is not submitted properly (wrong files, not in required format, etc.). For example,
o The submitted file can’t be opened.
o The submitted work is empty or wrong work.
o Other issues.
ï‚§ The project is a copy or partial copy of others' work (such as work from another person or the
Internet).
• Students must turn in their original work. Any cheating violation will be reported to the college.
Students can help others by sharing ideas, but not by allowing others to copy their work.
• Documents to be submitted as a zipped file:
 Algorithm – (created by adding a text file in Eclipse.)
 Java source file(s) with Javadoc style inline comments – (Java classes created with eclipse.)
ï‚§ Supporting files if any (For example, files containing all testing data.)
• Students are required to submit a design, all e
or-free source files with Javadoc style inline comments,
and supporting files. Lack of any of the required items will result in a really low credit or no credit.
• Your TA will grade, and then post the feedback and the grade on Blackboard if you have submitted it
properly and on time. If you have any questions regarding the feedback or the grade, please reach out
to the TA first. You may also contact the instructor for this matter.
3
Part II: Project grading ru
ic* (More information is included in the table on next page.)
Components Max points
Algorithm (See an example in part III.) Max. 10 points
Javadoc Inline comments (See an example in part III.) Max. 10 points
The rest of the project Max. 30 points
All projects will be evaluated based upon the following software development activities.
Analysis:
• Does the software meet the exact specification / customer requirements?
• Does the software solve the exact problem?
Design:
• Is the design efficient?
Code:
• Are there e
ors?
• Are code conventions followed?
• Does the software use the minimum computer resource (computer memory and processing
time)?
• Is the software reusable?
• Are comments completely written in Javadoc format?
a. Class Javadoc comments must be included before a class header.
. Method Javadoc comments must be included before a method header.
c. More inline comments (in either single line format or block format) must be included
inside each method body.
d. All comments must be completed in co
ect format such as tags, indentation etc.
Debug/Testing:
• Are there bugs in the software?
Documentation:
• Complete all documentations that are required.
4
Part III: How to complete a project from start to finish.
To complete a project, the following steps of a software development cycle should be followed. (These
steps are not pure linear but overlapped).
Analysis-design-code-test/debug-documentation.
1) Read project description to understand all specifications(Analysis).
2) Create a design (an algorithm for method or a UML class diagram for a class) (Design)
3) Create a Java program that is a translation of the design. (Code/Implementation)
4) Test and debug, and (test/debug)
5) Complete all required documentation. (Documentation)
To see the software development activities in action, we will now use the following example. We focus
on analysis, design, code/implementation, and debug/testing.
Sample problem:
Write a program to convert a user-entered temperature from Fahrenheit to Celsius. Here is the sample
un (When user enters 32, 0 is displayed.):
Enter a temperature in Fahrenheit: 32
This is equivalent to:
0 Celsius
Analysis:
Software must be made to meet all customer requirements/specifications. The program must satisfy
the following requirements:
• It must let the user enter a temperature (Fahrenheit) to be converted.
• It must compute an equivalent temperature in Celsius.
Design:
During system design, you create a solution to the problem. A solution can be written as an algorithm.
An algorithm is a logical series of steps converting inputs to desired outputs. An algorithm consists of
three components: input, process, and output. Inputs specifies user-entered input values in order.
Process specifies how user-entered input values can be converted into desired output values. Output
specifies how output values can be displayed. To convert a temperature from Fahrenheit to Celsius,
the formula XXXXXXXXXXcan be used. The complete solution/algorithm is shown below.
Summary:
Convert a temperature from Fahrenheit to Celsius.
1. Read a temperature in Fahrenheit entered by user.
2. Subtract 32 from the temperature.
3. And then, multiply the result by 5.
4. And then divide the result by 9.
5. Display the temperature in Celsius.
Code:
Implementation is also known as coding (writing the code). In this stage, an algorithm is translated into
a method.
Add a Java class, add comments in Javadoc format for the class and method main, copy the algorithm
into the body of main as comments.
Input
Process
Output
5
**
* Temperature conversion from Fahrenheit to Celsius.
* @author Qi Wang
* @version 1.0
*/
public class TemperatureConverter{
/**
* Reads a temperature in Fahrenheit, and converts it to a temperature in Celsius.
* @param args A reference to a string a
ay containing command-line arguments
*/
public static void main(String[] args){
1. Read a temperature in Fahrenheit entered by user.
2. Subtract 32 from the temperature.
3. And then, multiply the result by 5.
4. And then divide the result by 9.
5. Display the temperature in Celsius.
}
}
In this stage, proper data types are selected when reserving memory to store input values, output
values, and important values of process. These values need to be stored in memory so that they can be
eused without recalculation. In this case, the input (temperature in Fahrenheit) needs to be stored;
the output (temperature in Celsius) needs to be stored. Since the process is very simple, it is not
necessary to stored result from step 2 and 3 of the algorithm. All variables need to be declared at the
eginning of a method for readability.
import java.util.Scanner;
**
* Temperature conversion from Fahrenheit to Celsius.
* @author Qi Wang
* @version 1.0
*/
public class TemperatureConverter{
/**
* Reads a temperature in Fahrenheit, and converts it to a temperature in Celsius.
* @param args A reference to a string a
ay containing command-line arguments
*/
public static void main(String[] args){
XXXXXXXXXXdouble celsiusTemp, fahrenheitTemp;
XXXXXXXXXXScanner scan = new Scanner(System.in);
XXXXXXXXXXDecimalFormat temperatureFormat = new DecimalFormat("0.00");
1. Read a temperature in Fahrenheit entered by user.
2. Subtract 32 from the temperature.
3. And then, multiply the result by 5.
4. And then divide the result by 9.
5. Display the temperature in Celsius.
}
}
Variables
celsiusTemp Memory to store input of double type.
fahrenheitTemp Memory to store output of double type.
scan An object reference to a Scanner object that reads input from keyboard.
temperatureFormat An object reference to a DecimalFormat object that formats a value into a string
containing two decimal digits.
You may need to declare more variables later. Always add new variables to the beginning of the
method.
6
Next, you will translate steps of the algorithm into java code. More requirements including how input
should be entered and how output should be displayed need to be identified/met in this stage. For
example, the sample run below
Enter a temperature in Fahrenheit: 32
This is equivalent to:
0 Celsius
shows additional implementation requirements:
1. The user-entered temperature must be entered at the end of the same line after the exact
prompt:
Enter a temperature in Fahrenheit:
2. A line containing This is equivalent to: (an exact description) must be inserted as a newline
efore displaying output.
3. Celsius (an exact description) must be displayed