Latest topics | » Assignment 02: Simple Calculating by cambeme 18/10/2011, 23:50
» CHƯƠNG V: HỌC THUYẾT GIÁ TRỊ THẶNG DƯ - Trang 47-hết by anhkhoamc083 5/10/2011, 08:51
» Bài tập SwingDemo by cambeme 16/9/2011, 12:22
» ass3 cau 2 by nguyentam 29/5/2011, 10:46
» Assignment 09: Classes by cambeme 27/5/2011, 17:57
» GROUP EXERCISE 03 by cambeme 24/5/2011, 18:23
» Bản kiểm điểm by nhoc_vet 20/5/2011, 19:29
» Trình bày GROUP EXERCISE 02 by cambeme 20/5/2011, 00:01
» Khát là gì? by cambeme 18/5/2011, 22:01
» Assignment 08: Methods by cambeme 15/5/2011, 23:48
» GROUP EXERCISE 02 by cambeme 11/5/2011, 22:14
» Website nhóm 1 by cambeme 10/5/2011, 20:06
» Giao diện trang chủ by cambeme 10/5/2011, 13:00
» Cấu hình DHCP RELAY AGENT - cấp cho 2 mạng LAN by cambeme 9/5/2011, 23:59
» Slide 16 by cambeme 6/5/2011, 23:09
» Slide 15 by cambeme 6/5/2011, 23:08
» Slide 14 by cambeme 6/5/2011, 23:07
» Assignment 07: Control and Flow by cambeme 6/5/2011, 22:33
» Trình bày GROUP EXERCISE 01 by cambeme 6/5/2011, 00:36
» GROUP EXERCISE 01 by cambeme 5/5/2011, 15:26
» Bai 1 by nguyentam 4/5/2011, 19:24
» cau thu 3 by cambeme 1/5/2011, 15:00
» day la bai so 2 by nguyentam 30/4/2011, 17:06
» chi tiet lam DNS by nguyentam 30/4/2011, 16:40
» Tài liệu Windows Server 2003 by cambeme 30/4/2011, 08:40
» Phần mềm by cambeme 29/4/2011, 12:35
» Công cụ tạo máy ảo VMware Workstation 7.1.4 Build 385546 Final by cambeme 25/4/2011, 20:08
» Đề kiểm tra giữa kỳ Network by cambeme 15/4/2011, 11:53
» Higher Computing Systems Networking by cambeme 15/4/2011, 10:40
» Bài tập chương 6 by cambeme 12/4/2011, 17:41
|
| | Assignment 02 – Simple Computing and Converter | |
| Tác giả | Thông điệp |
---|
cambeme
Giới tính : Cung : Con giáp : Bài gửi : 174 Điểm : 5264 Thanks : 0 Sinh nhật : 05/12/1991 Ngày gia nhập : 25/03/2011 Tuổi : 32 Đến từ : Thành phố Hồ Chí minh Nghề nghiệp/ước mơ : IT Tâm trạng : Hưng phắn Châm ngôn sống : Không có gì quý hơn hột vịt thịt kho!
Cao nhân tắt thở vô phương trị!
| Tiêu đề: Assignment 02 – Simple Computing and Converter 29/3/2011, 18:34 | |
| | 29/3/2011, 18:34 Assignment 02 – Simple Computing and Converter | | | Bài 1: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro01_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub int w = 0; // input width System.out.print("Nhap canh hinh vuong: "); w = in.nextInt(); // calculate and print out the result System.out.println("Chu vi cua hinh vuong: p = " + (w * 4)); System.out.println("Dien tich cua hinh vuong: a = " + (w * w));
}// end main function
}// end class Bài 2: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro02_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double w = 0, l = 0; // input width System.out.print("Nhap chieu rong: "); w = in.nextDouble(); // input length System.out.print("Nhap chieu dai: "); l = in.nextDouble(); // calculate and print out the result System.out.println("Chu vi cua hinh chu nhat: p = " + (l + w) * 2); System.out.println("Dien tich cua hinh chu nhat: a = " + (l * w)); }// end main function
}// end class Bài 3: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro03_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double d = 0; // input diameter System.out.print("Nhap duong kinh: "); d = in.nextDouble(); // calculate and print out the result System.out.println("Chu vi cua hinh tron: p = " + (d * 3.14)); System.out.println("Dien tich cua tron: a = " + ((d * d / 4) * 3.14)); }// end main function
}// end class Bài 4: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro04_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double a = 0, b = 0, c = 0, d = 0; // input a System.out.print("Nhap canh a: "); a = in.nextDouble(); // input b System.out.print("Nhap canh b: "); b = in.nextDouble(); // input c System.out.print("Nhap canh c: "); c = in.nextDouble(); // calculate and print out the result d = (a + b + c) / 2;// half the circumference System.out.println("Chu vi cua hinh tam giac: p = " + (a + b + c)); System.out.println("Dien tich cua hinh tam giac: s = " + Math.sqrt(d * (d - a) * (d - b) * (d - c))); }// end main function }// end class Bài 5: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro05_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable int m = 0, n = 0, p = 0, q = 0; // input m System.out.print("Nhap m: "); m = in.nextInt(); // input n System.out.print("Nhap n: "); n = in.nextInt(); // input p System.out.print("Nhap p: "); p = in.nextInt(); // input q System.out.print("Nhap q: "); q = in.nextInt(); // calculate and print out the result System.out.println("Tong: sum = " + (m + n + p + q)); System.out.println("Trung binh cong: ave = " + (((double) m + n + p + q) / 4)); }// end main function }// end class Bài 6: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro06_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable int m = 0, n = 0; // input m System.out.print("Nhap m: "); m = in.nextInt(); // input n System.out.print("Nhap n: "); n = in.nextInt(); // calculate and print out the result System.out.println("So du khi lay m chia n: r = " + (m % n)); System.out.println("Ket qua khi lay m chia n: q = " + ((double) m / n)); }// end main function }// end class Bài 7: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro07_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double me = 0; // input meter System.out.print("Nhap so met: "); me = in.nextDouble(); // calculate and print out the result System.out.println("Chieu dai tinh bang mile: mi= " + (me / (1609344 / 1000))); }// end main function }// end class Bài 8: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro08_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double OU = 0; // input ounce System.out.print("Nhap so ounce: "); OU = in.nextDouble(); // calculate and print out the result System.out.println("Khoi luong vang tuong ung: LU = " + (OU * (28.349523125 / 37.5))); }// end main function }// end class Bài 9: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro09_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double ir = 0, am = 0; // input interest rate System.out.print("Nhap lai suat: "); ir = in.nextDouble(); // input amount System.out.print("Nhap so tien gui: "); am = in.nextDouble(); // calculate and print out the result System.out.println("Tong so tien: ta = " + (am * (1 + ir * 3 / 12))); }// end main function }// end class Bài 10: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro10_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double ir = 0, ia = 0, nm = 0; // input interest rate System.out.print("Nhap lai suat: "); ir = in.nextDouble(); // input interest amount System.out.print("Nhap so tien vay: "); ia = in.nextDouble(); // input number of month System.out.print("Nhap so thang: "); nm = in.nextDouble(); // calculate and print out the result System.out.println("Tong so tien phai tra: ta = " + (ia * (1 + ir * nm / 12))); System.out.println("So tien phai tra tung thang: pm = " + ((ia * (1 + ir * nm / 12)) / nm)); }// end main function }// end class
| | | | |
Được sửa bởi cambeme ngày 1/4/2011, 12:10; sửa lần 2. |
| | | cambeme
Giới tính : Cung : Con giáp : Bài gửi : 174 Điểm : 5264 Thanks : 0 Sinh nhật : 05/12/1991 Ngày gia nhập : 25/03/2011 Tuổi : 32 Đến từ : Thành phố Hồ Chí minh Nghề nghiệp/ước mơ : IT Tâm trạng : Hưng phắn Châm ngôn sống : Không có gì quý hơn hột vịt thịt kho!
Cao nhân tắt thở vô phương trị!
| Tiêu đề: Re: Assignment 02 – Simple Computing and Converter 29/3/2011, 18:46 | |
| | 29/3/2011, 18:46 Re: Assignment 02 – Simple Computing and Converter | | | Bài 11: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro11_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double x1, y1, x2, y2, a; // input the first number System.out.print("Nhap gia tri x1 = "); x1 = in.nextDouble(); // input the second number System.out.print("Nhap gia tri y1 = "); y1 = in.nextDouble(); // input the third number System.out.print("Nhap gia tri x2 = "); x2 = in.nextDouble(); // input the forth number System.out.print("Nhap gia tri y2 = "); y2 = in.nextDouble(); // calculate a = Math.sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); // print out the result System.out.print("Khoang cach giua hai diem co toa do (" + x1 + "," + y1 + ") va (" + x2 + "," + y2 + ") la "); System.out.println(a); }// end main function
}// end class Bài 12: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro12_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double x = 0; // input x System.out.print("Nhap x: "); x = in.nextDouble(); // calculate and print out the result System.out.println("Ket qua: f(" + (x) + ")= " + (2 * x * x - 5 * x + 3)); }// end main function
}// end class
Bài 13: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro13_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable double x = 0; // input x System.out.print("Nhap x: "); x = in.nextDouble(); // calculate and print out the result System.out.println("Ket qua: f(" + (x) + ")= " + ((2 * Math.sin(x) * Math.sin(x)) - (5 * Math.cos(x)))); }// end main function
}// end class Bài 14: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro14_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable float ga, li; // input the number System.out.print("Input = "); ga = in.nextFloat(); // calculate li = (float) (ga * 3.7854); // print out the result System.out.print(ga + " gallons is "); System.out.print(li + " liters."); }// end main function
}// end class Bài 15: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro15_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable float ya, me; // input the number System.out.print("Input = "); ya = in.nextFloat(); // calculate me = (float) ya * 914 / 1000; // print out the result System.out.print(ya + " yards is "); System.out.print(me + " meters.");
}// end main function
}// end class Bài 16: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro16_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable float po, kg; // input the number System.out.print("Input = "); po = in.nextFloat(); // calculate kg = (float) po * 454 / 1000; // print out the result System.out.print(po + " pounds is "); System.out.print(kg + " kilograms.");
}// end main function
}// end class Bài 17: - Code:
-
import java.util.Scanner; import java.io.*;
/* * @author Trinh Thai Anh * T094054 */ @SuppressWarnings("unused") public class cAss02Pro17_T094054 { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader str = new BufferedReader( new InputStreamReader(System.in));// The reader // input the string System.out.print("Nhap chuoi: "); String str1 = str.readLine(); // print out the result System.out.println(str1.toLowerCase()); }// end main function
}// end class Bài 18: - Code:
-
import java.io.*; import java.util.*;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro18_T094054 { /** * @param args */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader str = new BufferedReader( new InputStreamReader(System.in));// The reader // input the string System.out.print("Fullname: "); String str1 = str.readLine(); // Break Fullname into individual words StringTokenizer st = new StringTokenizer(str1); while (st.hasMoreTokens()) { String ten = st.nextToken(); String dem = st.nextToken(); String ho = st.nextToken(); // print out the result with UpperCase System.out.println("Firstname: " + ho.toUpperCase()); System.out.println("Middlename: " + dem.toUpperCase()); System.out.println("Lastname: " + ten.toUpperCase()); } }// end main function
}// end class Bài 19: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro19_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable int hh1 = 0, MM1 = 0, ss1 = 0, hh2 = 0, MM2 = 0, ss2 = 0; // input hh1 System.out.print("Nhap hh1: "); hh1 = in.nextInt(); // input MM1 System.out.print("Nhap MM1: "); MM1 = in.nextInt(); // input ss1 System.out.print("Nhap ss1: "); ss1 = in.nextInt(); // input hh2 System.out.print("Nhap hh2: "); hh2 = in.nextInt(); // input MM2 System.out.print("Nhap MM2: "); MM2 = in.nextInt(); // input ss2 System.out.print("Nhap ss2: "); ss2 = in.nextInt(); // calculate and print out the result System.out.println("Thoi gian ngưoi thu nhat da chay: " + (hh1 * 3600 + MM1 * 60 + ss1)); System.out.println("Thoi gian ngưoi thu hai da chay: " + (hh2 * 3600 + MM2 * 60 + ss2)); }// end main function
}// end class Bài 20: - Code:
-
import java.util.Scanner;
/* * @author Trinh Thai Anh * T094054 */ public class cAss02Pro20_T094054 { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in);// The reader // TODO Auto-generated method stub // Declare the variable int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0; // input c1 System.out.print("Nhap so luong c1: "); c1 = in.nextInt(); // input c2 System.out.print("Nhap so luong c2: "); c2 = in.nextInt(); // input c3 System.out.print("Nhap so luong c3: "); c3 = in.nextInt(); // input c4 System.out.print("Nhap so luong c4: "); c4 = in.nextInt(); // input c5 System.out.print("Nhap so luong c5: "); c5 = in.nextInt(); // input c6 System.out.print("Nhap so luong c6: "); c6 = in.nextInt(); // calculate and print out the result System.out.println("So tien thu duoc trong ngay income = " + (c1 * 30 * 1 + c2 * 35 * 1 + c3 * 40 * 2 + c4 * 45 * 2 + c5 * 50 * 3 + c6 * 60 * 3)); System.out.println("So luong ga da tieu thu trong ngay k_used = " + (c1 * 1 + c2 * 1 + c3 * 2 + c4 * 2 + c5 * 3 + c6 * 3)); System.out .println("So luong ga can du kien cho ngay hom sau k_plan = " + ((c1 * 1 + c2 * 1 + c3 * 2 + c4 * 2 + c5 * 3 + c6 * 3) + ((c1 * 1 + c2 * 1 + c3 * 2 + c4 * 2 + c5 * 3 + c6 * 3) / 10))); }// end main function
}// end class
| | | | | |
| | | | Assignment 02 – Simple Computing and Converter | |
|
Similar topics | |
|
Trang 1 trong tổng số 1 trang | |
| Permissions in this forum: | Bạn không có quyền trả lời bài viết
| |
| |
| |