Download 204700 Data Structure and Programming Languages

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Class (computer programming) wikipedia , lookup

Functional programming wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Programming language wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Java (programming language) wikipedia , lookup

Reactive programming wikipedia , lookup

Corecursion wikipedia , lookup

Structured programming wikipedia , lookup

Object-oriented programming wikipedia , lookup

Java ConcurrentMap wikipedia , lookup

Java performance wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Transcript
204700 Data Structure and Programming Languages
Assignment 1
In this assignment, you will create a program that converts the Celsius to Fahrenheit
degrees (C to F).
Part One
1. Create a new class called C2FConvertor.
2. Copy and paste the following initial version:
class C2FConvertor {
public static void main(String[] arguments) {
double c_temp = 30;
double f_temp = 0.0;
System.out.println(c_temp + " degrees Celsius is equal to "
+ f_temp + " degrees Fahrenheit.");
}
}
3. Run it in Eclipse (Run->Run As -> Java Application).
What is the output of the unmodified program?
Answer…………………………………………………………………….
Part Two
Modify the example program to compute the Fahrenheit degree when given the 50
degree Celsius (change double c_temp = 30; to double c_temp = 50;). The formula in
Math notation is:
C/5 = (F-32)/9
Note that: The correct answer is 122. Java will output more digits after decimal place,
but that is unimportant.
204700 Data Structure and Programming Languages
Assignment 2
Convert Celsius degree to Fahrenheit degree with a given Celsius degree from user
(ให้ ทำส่วนรับข้ อมูลเพิ่มเข้ ำมำ)
เมื่อทำ Assignment 2 เสร็จให้ สง่ Source Code (ไฟล์ .java) มำที่ [email protected] ให้ ระบุ
subject ว่ำ Assignment 2(รหัสนักศึกษำ)