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)
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2021-03-04 06:57:21
/*
* 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 newpackage;
import java.util.Scanner;
/**
*
* @author WIN10
*/
public class test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n;
ConversionUtil c = new ConversionUtil ();
do {
System.out.println("nhap lua chon: ");
n = scan.nextInt();
switch(n){
case 1:
System.out.println("nhap do c: ");
double c = scan.nextDouble();
System.out.println("do f = " +c.fToc(c));
break;
case 2:
System.out.println("nhap do c: ");
double f = scan.nextDouble();
System.out.println("do c = " +c.cTof(f));
break;
}
}while (n!=3);
}
public static void menu(){
System.out.println("1: kt do f");
System.out.println("2: kt do c");
}
}
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2021-03-04 06:57:04
/*
* 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 newpackage;
/**
*
* @author WIN10
*/
public class ConversionUtil {
double f;
double c;
public ConversionUtil() {
}
public double getF() {
return f;
}
public void setF(double f) {
this.f = f;
}
public double getC() {
return c;
}
public void setC(double c) {
this.c = c;
}
public double fToC(double f) {
double F;
F = (9.0 / 5) * (c + 32);
return F;
}
public double cTof(double c) {
double C;
C = (05 / 9) * (f – 32);
return C;
}
}
![Trần Văn Lâm [T2008A]](https://www.gravatar.com/avatar/cfc15c8cb7781ad669b013e01f9f1a6b.jpg?s=80&d=mm&r=g)
Trần Văn Lâm
2021-03-03 10:14:31
/*
* 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 test;
import java.util.Scanner;
/**
*
* @author Administrator
*/
public class ConversionUtil{
double fahrenheit;
double celsius ;
public double fDegree(){
double C = (5/9) * (fahrenheit - 32);
return C;
}
public double cDegree(){
double F = celsius / (5/9)*32 ;
return F;
}
public ConversionUtil() {
}
public ConversionUtil(double fahrenheit, double celsius) {
this.fahrenheit = fahrenheit;
this.celsius = celsius;
}
public double getFahrenheit() {
return fahrenheit;
}
public void setFahrenheit(double fahrenheit) {
this.fahrenheit = fahrenheit;
}
public double getCelsius() {
return celsius;
}
public void setCelsius(double celsius) {
this.celsius = celsius;
}
public void input(){
Scanner scan = new Scanner(System.in);
System.out.println("Nhap so fahrenheit =");
fahrenheit = scan.nextDouble();
System.out.println("Nhap so celsius =");
celsius = scan.nextDouble();
}
}
![Trần Văn Lâm [T2008A]](https://www.gravatar.com/avatar/cfc15c8cb7781ad669b013e01f9f1a6b.jpg?s=80&d=mm&r=g)
Trần Văn Lâm
2021-03-03 10:14:14
/*
* 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 test;
/**
*
* @author Administrator
*/
public class Test{
public static void main(String[] args){
ConversionUtil scan = new ConversionUtil();
scan.input();
scan.cDegree();
scan.cDegree();
}
}
![Do Trung Duc [T2008A]](https://www.gravatar.com/avatar/2973ac07124f066b4605c535e8d39a99.jpg?s=80&d=mm&r=g)
Do Trung Duc
2021-03-03 09:20:41
/*
* 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 Ex2;
import java.util.Arrays;
import java.util.Scanner;
/**
*
* @author TrungDuc
*/
public class Input {
public static void main(String[] agrs){
Scanner scan = new Scanner(System.in);
System.out.println("Nhap chuoi ");
String string = scan.nextLine();
String[] words = string.split("\\s");
System.out.println(Arrays.toString(words));
for(String word : words){
System.out.println(word);
}
}
}
![Do Trung Duc [T2008A]](https://www.gravatar.com/avatar/2973ac07124f066b4605c535e8d39a99.jpg?s=80&d=mm&r=g)
Do Trung Duc
2021-03-03 09:20:31
/*
* 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 Ex1;
import java.util.Scanner;
/**
*
* @author TrungDuc
*/
public class Test {
public static void main(String[] agrs){
Scanner scan = new Scanner(System.in);
System.out.println("Nhap do F");
float fahrenheit = Float.parseFloat(scan.nextLine());
System.out.println(fahrenheit);
ConversationUtil.fahrenheitToCelius(fahrenheit);
}
}
![Do Trung Duc [T2008A]](https://www.gravatar.com/avatar/2973ac07124f066b4605c535e8d39a99.jpg?s=80&d=mm&r=g)
Do Trung Duc
2021-03-03 09:20:19
/*
* 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 Ex1;
/**
*
* @author TrungDuc
*/
public class ConversationUtil {
public ConversationUtil() {
}
public static void fahrenheitToCelius(float fahrenheit){
float celsius = (float) ((0.555) * (fahrenheit - 32));
System.out.println("Do C:" + celsius);
}
public static void celiusToFahrenheit(float celius){
float fahrenheit = celius / (5/9) + 32;
System.out.println("Do F:" + fahrenheit);
}
}
![Trần Thị Khánh Huyền [T2008A]](https://www.gravatar.com/avatar/554e115833778e4294a01aebe228f3d6.jpg?s=80&d=mm&r=g)
Trần Thị Khánh Huyền
2021-03-03 09:20:08
//Bai 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 test;
import java.util.StringTokenizer;
import java.util.Scanner;
/**
*
* @author Admin
*/
public class Split {
public static void main(String[] args) {
String t;
Scanner sc = new Scanner (System.in);
System.out.println("Nhap 1 day: ");
t = sc.nextLine();
StringTokenizer st = new StringTokenizer(t);
while (st.hasMoreTokens()){
System.out.println(st.nextToken());
}
}
}
![Trần Thị Khánh Huyền [T2008A]](https://www.gravatar.com/avatar/554e115833778e4294a01aebe228f3d6.jpg?s=80&d=mm&r=g)
Trần Thị Khánh Huyền
2021-03-03 08:58:19
//Bai 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 test;
import java.util.StringTokenizer;
/**
*
* @author Admin
*/
public class Split {
public static void main(String[] args) {
StringTokenizer st = new StringTokenizer("fpt aptech ha noi");
while (st.hasMoreTokens()){
System.out.println(st.nextToken());
}
}
}
![Trần Thị Khánh Huyền [T2008A]](https://www.gravatar.com/avatar/554e115833778e4294a01aebe228f3d6.jpg?s=80&d=mm&r=g)
Trần Thị Khánh Huyền
2021-03-03 08:56:45
//bai 1
/*
* 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 test;
import java.util.Scanner;
/**
*
* @author Admin
*/
public class Test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double Fahrenheit, Celsius;
Scanner sc = new Scanner (System.in);
System.out.println("Nhap gia tri do Fahrenheit: ");
Fahrenheit=sc.nextFloat();
Celsius = 5*(Fahrenheit -32)/9;
System.out.println("Do Celsius tuong ung la: "+ Celsius);
}
}