By GokiSoft.com|
14:54 03/03/2021|
Java Basic
Examination- ADF1 - Java Basic - Thi thực hành - T1907A
Thời Gian Bắt Đầu Thi : 15:20 - 16:20
Các bạn làm xong thi upload code lên chủ đề này cho thầy.
Gửi bài chậm 1 phút -> trừ 0.5 điểm
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)
![Phạm Ngọc Minh [T1907A]](https://www.gravatar.com/avatar/9fa44938f36838ed4b4ac8e30e070c74.jpg?s=80&d=mm&r=g)
Phạm Ngọc Minh
2020-03-18 09:14:31
package Assiment;
import java.util.Scanner;
public class ConversionUtil {
public double fahrenheitToCelsius(double fDegree) {
return 5 * (fDegree - 32) / 9;
}
public double celciusToFahrenheit(double cDegree) {
return (9 * cDegree / 5) + 32;
}
}
package Assiment;
import java.util.Scanner;
public class Bait1 {
public static void main(String[] args) {
ConversionUtil cv = new ConversionUtil();
Scanner sc = new Scanner(System.in);
System.out.println("Nhập độ C cần đổi: ");
double cecius = sc.nextDouble();
System.out.println(cecius + " độ C = " + cv.celciusToFahrenheit(cecius) + " độ F");
System.out.println("Nhập độ F cần đổi: ");
double fahrenheit = sc.nextDouble();
System.out.println(cecius + " độ F = " + cv.fahrenheitToCelsius(fahrenheit) + " độ C");
}
}
b2
package Assiment;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Bkt2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a string: ");
String data = sc.nextLine();
StringTokenizer st = new StringTokenizer(data);
System.out.println("Result:");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}
}
}
![Phí Văn Long [T1907A]](https://www.gravatar.com/avatar/5db166b7b74443c5c221e4c0068d6da9.jpg?s=80&d=mm&r=g)
Phí Văn Long
2020-03-18 09:13:41
bài 1 :
conversionUtil:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package PracTestJavaI;
/**
*
* @author Nong
*/
public class ConversionUtil {
public double fahrenheitToCelsius(double fDegree){
return 5 * (fDegree - 32) /9;
}
public double celciusToFahrenheit(double cDegree){
return (9 * cDegree / 5) + 32;
}
}
Main:/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package PracTestJavaI;
import java.util.Scanner;
/**
*
* @author Nong
*/
public class Main {
public static void main (String[]args){
Scanner scanner = new Scanner(System.in);
ConversionUtil cover = new ConversionUtil();
System.out.println("Enter temperature in Fahrenheit");
Double temp = Double.parseDouble(scanner.nextLine());
System.out.println(cover.fahrenheitToCelsius(temp));
Double cel = Double.parseDouble(scanner.nextLine());
System.out.println(cover.celciusToFahrenheit(cel));
}
}
Bài 2 :
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package PracTestJavaI;
import java.util.Scanner;
import java.util.StringTokenizer;
/**
*
* @author Nong
*/
public class Exercise2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a string :");
String s = scanner.nextLine();
StringTokenizer string = new StringTokenizer(s);
while(string.hasMoreTokens()){
System.out.println(string.nextToken());
}
}
}
![Trương Công Vinh [T1907A]](https://www.gravatar.com/avatar/223a7e3a46f4a747f81b921fe023fcc4.jpg?s=80&d=mm&r=g)
Trương Công Vinh
2020-03-18 09:12:06
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Exam2;
import java.util.Scanner;
import java.util.StringTokenizer;
/**
*
* @author DELL
*/
public class Ex2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str;
System.out.println("Nhập vào chuỗi văn bản");
str = scan.nextLine();
StringTokenizer st = new StringTokenizer(str);
System.out.println("kết quả : ");
while (st.hasMoreTokens()) {
System.out.print(" \n "+st.nextToken()+" \n \n");
}
}
}
![Trương Công Vinh [T1907A]](https://www.gravatar.com/avatar/223a7e3a46f4a747f81b921fe023fcc4.jpg?s=80&d=mm&r=g)
Trương Công Vinh
2020-03-18 09:11:46
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Exam1;
/**
*
* @author DELL
*/
public class ConversionUtil {
public ConversionUtil() {
}
public double fahrenheitToCelsius (double fDegree){
double cDegree;
cDegree = ( (fDegree - 32)*(5/9));
return cDegree ;
}
public double celciusToFahrenheit (double cDegree){
double fDegree;
fDegree = (cDegree * (9/5) + 32);
return fDegree;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Exam1;
import java.util.Scanner;
/**
*
* @author DELL
*/
public class ConversUtil {
public static void main(String[] args) {
ConversionUtil exam = new ConversionUtil();
Scanner scan = new Scanner(System.in);
System.out.print(" Fahrenheit to Celsius : \n");
double a,b ;
System.out.println("Enter Fahrenheit : ");
a= Double.parseDouble(scan.nextLine());
System.out.println(">>>>"+exam.fahrenheitToCelsius(a));
System.out.println("Celsius to Fahrenheit : ");
System.out.println("Enter Celsius : ");
b= Double.parseDouble(scan.nextLine());
System.out.println(">>>>"+exam.celciusToFahrenheit(b));
}
}
![Luong Dinh Dai [T1907A]](https://www.gravatar.com/avatar/ca08fa4090e1038e541197564747f93c.jpg?s=80&d=mm&r=g)
Luong Dinh Dai
2020-03-18 08:53:43
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Bai1;
import java.util.Scanner;
/**
*
* @author FATE STORE
*/
public class ConversionUtil {
double fahrenheitToCelsius(double fDegree){
return 5*(fDegree-32)/9;
}
double celciusToFahrenheit(double cDegree){
return (9*cDegree/5)+32;
}
public static void main(String[] args) {
System.out.println("nhap do f can chuyen sang c: ");
ConversionUtil cov = new ConversionUtil();
Scanner sc = new Scanner(System.in);
double f,c;
f = sc.nextDouble();
System.out.println(cov.fahrenheitToCelsius(f));
System.out.println("Nhap do c can chuyen sang f: ");
c = sc.nextDouble();
System.out.println(cov.celciusToFahrenheit(c));
}
}
b2/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Bai1;
import java.util.Scanner;
import java.util.StringTokenizer;/**
*
* @author FATE STORE
*/
public class Bai2 {
public static void main(String[] args) {
System.out.println("Nhap vao chuoi bat ky: ");
Scanner sc = new Scanner(System.in);
StringTokenizer s = new StringTokenizer(sc.nextLine());
while(s.hasMoreTokens()){
System.out.println(s.nextToken());
}
}
}
![thienphu [T1907A]](https://www.gravatar.com/avatar/c4573ea65e411176c1852fd8584f1ab1.jpg?s=80&d=mm&r=g)
thienphu
2020-03-18 08:49:51
BT1:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Thi;
/**
*
* @author Thien Phu
*/
public class ConversionUtil {
public double fahrenheitToCelsius(double fDegree) {
return 5 * (fDegree - 32) / 9;
}
public double celciusToFahrenheit(double cDegree) {
return (9 * cDegree / 5) + 32;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Thi;
import java.util.Scanner;
/**
*
* @author Thien Phu
*/
public class MainEx1 {
public static void main(String[] args) {
ConversionUtil cv = new ConversionUtil();
Scanner sc = new Scanner(System.in);
System.out.println("Nhập vào độ Celcius cần đổi: ");
double cecius = sc.nextDouble();
System.out.println(cecius + " độ C = " + cv.celciusToFahrenheit(cecius) + " độ F");
System.out.println("Nhập vào độ Fahrenheit cần đổi: ");
double fahrenheit = sc.nextDouble();
System.out.println(cecius + " độ F = " + cv.fahrenheitToCelsius(fahrenheit) + " độ C");
}
}
BT2:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Thi;
/**
*
* @author Thien Phu
*/
import java.util.Scanner;
import java.util.StringTokenizer;
public class Exercise2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a string: ");
String data = sc.nextLine();
StringTokenizer st = new StringTokenizer(data);
System.out.println("Result:");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}
}
}