Tây bắc Người

All generations.

docstringMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

public class Vehicle { private int cylinder; private double price; //create constructor public Vehicle(int cylinder, double price){ this.cylinder = cylinder; this.price = price; } public int getCylinder() { return cylinder; } public double getPrice() { return price; } public void setCylinder(int cylinder) { this.cylinder = cylinder; } public void setPrice(double price) { this.price = price; } //calculate the registration tax declaration public double registrationTaxDeclaration() { double registrationTaxDeclaration; if(cylinder<=100){ registrationTaxDeclaration = price*0.01; } else if(cylinder<=200){ registrationTaxDeclaration = price*0.03; } else { registrationTaxDeclaration = price*0.05; } return registrationTaxDeclaration; } }

typingsMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

class Vehicle { private String name; private double capacity; private double price; private double tax; public Vehicle(String name, double capacity, double price) { this.name = name; this.capacity = capacity; this.price = price; } public void calculateTax() { if (this.capacity < 100) { this.tax = this.price * 0.01; } else if (this.capacity >= 100 && this.capacity <= 200) { this.tax = this.price * 0.03; } else { this.tax = this.price * 0.05; } } public void print() { System.out.println("Vehicle name: " + this.name); System.out.println("Capacity: " + this.capacity); System.out.println("Price: " + this.price); System.out.println("Tax: " + this.tax); } public String getName() {

linuxMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

package vehicle; import java.util.*; public class Vehicle { private String name; private long price; private long cylinder; public Vehicle(String name, long price, long cylinder) { this.name = name; this.price = price; this.cylinder = cylinder; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getPrice() { return price; } public void setPrice(long price) { this.price = price; } public long getCylinder() { return cylinder; } public void setCylinder(long cylinder) { this.cylinder = cylinder; } public long getTax(){ if(this.price < 100){ return this.price; }else if(this.price <= 200){ return this.price *3/100;

fix invalid codeMon, 27 Mar 2023

public static void main(String[] args) { double pi = 0; for (int i = 10000; i <= 100000; i++) { if (i % 2 == 0) { pi += (1 / (2.0 * i + 1.0)); } else { pi -= (1 / (2.0 * i + 1.0)); } } pi = pi * 4; System.out.println("giá trị của pi là: " + pi); }

public static void main(String[] args) { double pi = 0; for (int i = 10000; i <= 100000; i++) { if (i % 2 == 0) { pi -= (1 / (2.0 * i + 1.0)); } else { pi += (1 / (2.0 * i + 1.0)); } } pi = pi * 4; System.out.println("giá trị của pi là: " + pi); }

fix invalid codeSun, 16 Apr 2023

public class pixel { class Pixel extends point { public Pixel() { super(); } public Pixel(int x, int y, String tenMau, String maMau) { super(x, y, tenMau, maMau); } public boolean kiemtra() { return ktCheoChinh()&&gettenMau().equals("Xanh"); } } }

public class pixel { class Pixel extends point { public Pixel() { super(); } public Pixel(int x, int y, String tenMau, String maMau) { super(x, y, tenMau, maMau); } public boolean kiemtra() { return ktCheoChinh()&&gettenMau().equals("Xanh"); } } }

fix invalid codeSat, 06 May 2023

public class Main { public static void Main(String[] args) { ArrayList<SinhVien> danhSachsv = new ArrayList<>(); System.out.println("Nhập thông tin cho danh sách sinh viên: "); for (int i = 0; i < 10; i++) { SinhVien sv = new SinhVien(); sv.nhapThongTin(); danhSachsv.add(sv); } Collections.sort(danhSachsv); System.out.println("Danh sách sinh viên theo thứ tự tăng dần về họ và tên: "); for (SinhVien sv :danhSachsv) { System.out.println(sv.gethovaten()); } Collections.sort(danhSachsv, Collections.reverseOrder()); System.out.println("Danh sách sinh viên theo thứ tự giảm dần về họ và tên: "); for(SinhVien sv :danhSachsv){ System.out.println(sv.gethovaten()); } } }

public class Main { public static void Main(String[] args) { ArrayList<SinhVien> danhSachsv = new ArrayList<>(); System.out.println("Nhập thông tin cho danh sách sinh viên: "); for (int i = 0; i < 10; i++) { SinhVien sv = new SinhVien(); sv.nhapThongTin(); danhSachsv.add(sv); } Collections.sort(danhSachsv); System.out.println("Danh sách sinh viên theo thứ tự tăng dần về họ và tên: "); for (SinhVien sv :danhSachsv) { System.out.println(sv.gethovaten()); } Collections.sort(danhSachsv, Collections.reverseOrder()); System

css from descriptionMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

class SinhVien { private String masv; private String tensv; private int gt; private int namsinh; private String sdt; private String email; private String diachi; private String lop; private String khoa; private float diemthi; private float diemthuchanh; private float diemtietkiem; private float diemthi; private float diemtbt; public SinhVien(String masv, String tensv, int gt, int namsinh, String sdt, String email, String diachi, String lop, String khoa, float diemthi, float diemthuchanh, float diemtietkiem, float diemthi, float diemtbt) { this.masv = masv; this.tensv = tensv; this.gt = gt; this.namsinh = namsinh;

code to explanationSun, 26 Mar 2023

Write a program to calculate the result of the formula pi in java 𝜋=4(1−1/3+1/5−1/7+1/9−1/11+1/13−⋯−1/2𝑖−1+1/2𝑖+1) with 10000 ≤ i ≤ 100000

public class pi { public static void main(String[] args) { double pi = 4; double i = 3; double precision = 0.00000001; double result = 0; for (i = 3; i < 100000; i += 2) { double k = (double) 1 / i; if (i % 4 == 1) { pi = pi - k; } else { pi = pi + k; } result = pi; } System.out.println(result); } }

linuxMon, 27 Mar 2023

Write a program to calculate the result of the formula pi in java 𝜋=4(1−1/3+1/5−1/7+1/9−1/11+1/13−⋯−1/2𝑖−1+1/2𝑖+1) with 10000 ≤ i ≤ 100000

public class CalcPi{ public static void main(String[] args){ System.out.println("Calculating pi with BigDecimal"); BigDecimal pi = new BigDecimal(0); boolean isMinus = true; for(int i=10000; i<100000; i++){ BigDecimal denominator = new BigDecimal(2*i+1); BigDecimal term; if(isMinus){ term = new BigDecimal(-1).divide(denominator, new MathContext(10000)); }else{ term = new BigDecimal(1).divide(denominator, new MathContext(10000)); } pi = pi.add(term); isMinus = !isMinus; } pi = pi.multiply(new BigDecimal(4)); System.out.println("pi = "+pi); } }

fix invalid codeMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

https://github.com/a-nguyen-it/markdown-test/blob/master/img/java.png

fix invalid codeMon, 24 Apr 2023

public class Main { public static void main(String[] args) { quanlygiaodich qlgd = new quanlygiaodich(); String maGiaoDich = "GD001"; Date ngayGiaoDich = new Date(2023, 4, 24); double donGia = 5000000; double soLuong = 10; String loaiVang = "18K"; qlgd.xuatDanhSachGiaoDich(); } }

public class Main { public static void main(String[] args) { quanlygiaodich qlgd = new quanlygiaodich(); String maGiaoDich = "GD001"; Date ngayGiaoDich = new Date(2023, 4, 24); double donGia = 5000000; double soLuong = 10; String loaiVang = "18K"; qlgd.nhapGiaoDichVang(maGiaoDich, ngayGiaoDich, donGia, soLuong, loaiVang); String maGD = "GD002"; Date ngayGD = new Date(2021, 1, 11); double dongia = 12000000; double soluong = 10; String loaiTienTe = "USD"; qlgd.nhapGiaoDichTienTe(maGD, ngayGD, dongia, soluong, loaiTienTe); qlgd.xuat

gitMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

class Vehicle { private String name; private int cc; private int value; private float enviromentTax; public Vehicle() { } public Vehicle(String name, int cc, int value) { this.name = name; this.cc = cc; this.value = value; if(this.cc < 100){ this.enviromentTax = this.value * 1 / 100; }else if(this.cc < 200){ this.enviromentTax = this.value * 3 / 100; }else{ this.enviromentTax = this.value * 5 / 100; } } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getCc() { return cc; } public void setCc(int cc) { this.cc = cc; } public

metaMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

<h2>Tạo 1 trang web theo yêu cầu ở bên dưới</h2> <h3>Các tính năng cần có:</h3> <ul> <li><h4>Trang chủ:</h4></li> <ul> <li>Có header với logo + menu</li> <li>Có footer với thông tin website</li> <li>Có slider ảnh tự động chuyển</li> <li>Phần giới thiệu về website</li> <li>Phần sản phẩm</li> </ul> <li><h4>Trang sản ph

text to sql syntaxMon, 03 Apr 2023

Viết chương trình xây dựng một lớp PhanSo gồm có 2 thuộc tính là tử số (numerator) và mẫu số (denominator). Chương trình có các phương thức getter và setter cho các thuộc tính và có các chức năng sau: - reduce(): tối giản phân số - inverse(): nghịch đảo phân số - add(PhanSo p2): cộng 2 phân số - subtract(PhanSo p2): trừ 2 phân số - multiple(PhanSo p2): nhân 2 phân số - divide(PhanSo p2): chia 2 phân số - compare(PhanSo p2): so sánh 2 phân số. Trả về 0 nếu 2 phân số bằng nhau, 1 nếu phân số thứ 1 lớn hơn và -1 nếu phân số thứ nhất bé hơn trong java

class PhanSo { private int numerator; private int denominator; int getNumerator() { return numerator; } void setNumerator(int numerator) { this.numerator = numerator; } int getDenominator() { return denominator; } void setDenominator(int denominator) { this.denominator = denominator; } void reduce() { int i = 2; while (i <= numerator && i <= denominator) { if (numerator % i == 0 && denominator % i == 0) { numerator /= i; denominator /= i; } else { i++; } } } void inverse() { int temp = numerator; numerator = denominator; denominator = temp; } void add(PhanSo p) { numerator *= p.denominator;

time complexityMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

class Vehicle { String name; String color; int capacity; float price; public Vehicle(){} public Vehicle(String name, String color, int capacity, float price) { this.name = name; this.color = color; this.capacity = capacity; this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public int getCapacity() { return capacity; } public void setCapacity(int capacity) { this.capacity = capacity; } public float getPrice() { return price; } public void setPrice(float price) { this.price = price; } public float getTax(){ if(

linuxMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

java public class SinhVien{ private String hoTen; private int namSinh; private String gioiTinh; private double diemLyThuyet; private double diemThucHanh; private double diemGiuaKy; private double diemCuoiKy; public SinhVien(String hoTen, int namSinh, String gioiTinh, double diemLyThuyet, double diemThucHanh, double diemGiuaKy, double diemCuoiKy) { this.hoTen = hoTen; this.namSinh = namSinh; this.gioiTinh = gioiTinh; this.diemLyThuyet = diemLyThuyet; this.diemThucHanh = diemThucHanh; this.diemGiuaKy = diemGiuaKy; this.diemCuoiKy

regexMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

public class SinhVien { public static void main(String[] args) { SinhVien sv1 = new SinhVien(); sv1.diemThi = 0; sv1.diemLyThuyet = 0; sv1.diemThucHanh = 0; sv1.diemGiuaKy = 0; sv1.ten = ""; sv1.maSV = ""; sv1.namSinh = ""; sv1.gioiTinh = ""; sv1.diaChi = ""; sv1.lop = ""; } int diemThi; int diemLyThuyet; int diemThucHanh; int diemGiuaKy; String ten; String maSV; String namSinh; String gioiTinh; String diaChi; String lop; SinhVien(){

fix invalid codeSat, 06 May 2023

public class Main { public static void Main(String[] args) { ArrayList<SinhVien> danhSachsv = new ArrayList<>(); System.out.println("Nhập thông tin cho danh sách sinh viên: "); for (int i = 0; i < 10; i++) { SinhVien sv = new SinhVien(); sv.nhapThongTin(); danhSachsv.add(sv); } Collections.sort(danhSachsv); System.out.println("Danh sách sinh viên theo thứ tự tăng dần về họ và tên: "); for (SinhVien sv :danhSachsv) { System.out.println(sv.gethovaten()); } Collections.sort(danhSachsv, Collections.reverseOrder()); System.out.println("Danh sách sinh viên theo thứ tự giảm dần về họ và tên: "); for(SinhVien sv :danhSachsv){ System.out.println(sv.gethovaten()); } } }

translateMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

public class SinhVien { private String name; private int age; private String address; private String gender; private String phone; private String studentID; private String status; private float theory; private float practice; private float midterm; private float final; public SinhVien() { theory = practice = midterm = final = 0; } public SinhVien(String name, int age, String address, String gender, String phone, String studentID, String status) { this.name = name; this.age = age; this.address = address; this.gender = gender; this.phone = phone; this.studentID = studentID; this.status = status; this.theory = 0; this.practice = 0; this.midterm = 0; this.final = 0; } public SinhVien(String name, int age, String address, String gender, String phone, String student

Java
View
text to sql syntaxMon, 24 Apr 2023

xây dựng chương trình Một thư viện X quản lý danh sách các loại sách. Thông tin về các loại sách: Sách giáo khoa: Mã sách, ngày nhập (ngày, tháng, năm), đơn giá, số lượng, nhà xuất bản, tình trạng (mới, cũ). Nếu tình trạng sách là mới thì: thành tiền = số lượng * đơn giá. Nếu tình trạng sách là cũ thì: thành tiền = số lượng * đơn giá * 50% Sách tham khảo: Mã sách, ngày nhập (ngày, tháng, năm), đơn giá, số lượng, nhà xuất bản, thuế. Thành tiền = số lượng * đơn giá +thuế Thực hiện các yêu cầu sau: Xây dựng các lớp với chức năng thừa kế. Nhập xuất danh sách các loại sách (Sử dụng mảng). Tính tổng thành tiền cho từng loại. Tính trung bình cộng đơn giá của các sách tham khảo. Xuất ra các sách giáo khoa của nhà xuất bản X trong java

public class Sach { String maSach, nhaXuatBan; float donGia; int ngayNhap, thangNhap, namNhap, soLuong; } public class SachGiaoKhoa extends Sach { String tinhTrang; public float thanhTien() { if(tinhTrang.equalsIgnoreCase("mới")) return donGia * soLuong; else if(tinhTrang.equalsIgnoreCase("cũ")) return donGia * soLuong * 0.5; else return 0; } } public class SachThamKhao extends Sach { float thue; public float thanhTien() { return donGia * soLuong + thue; } }

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

java public class SinhVien { public String ten; public int tuoi; public String gioitinh; public double diemLT; public double diemTH; public double diemTHI; public double diemTB; public double getDiemTB() { return diemTB; } public void setDiemTB(double diemTB) { this.diemTB = diemTB; } public String getTen() { return ten; } public void setTen(String ten) { this.ten = ten; } public int getTuoi() { return tuoi; } public void setTuoi(int tuoi) { this.tuoi = tuoi; } public String getGioitinh() { return gioitinh; } public void setGioitinh(String gioitinh) { this.gio

text to sql syntaxMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0 Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all member properties of the object in java

package student; public class SinhVien { public String name; public int age; public String gioiTinh; public double theory; public double practice; public double mid; public double final_; public double getTheory() { return theory; } public void setTheory(double theory) { this.theory = theory; } public double getPractice() { return practice; } public void setPractice(double practice) { this.practice = practice; } public double getMid() { return mid; } public void setMid(double mid) { this.mid = mid; } public double getFinal_() { return final_; } public void setFinal_(double final_) { this.final_ = final_; } public double calculateAverage() { return (theory*0.2) + (practice*0.

text to sql syntaxMon, 27 Mar 2023

Write a program to build a class PhanSo that has 2 properties, numerator and denominator. The program has getter and setter methods for properties and has the following functions: - reduce(): minimize fractions - inverse(): inverse fraction - add(PhanSo p2): add 2 fractions - subtract(PhanSo p2): subtract 2 fractions - multiple(PhanSo p2): multiply 2 fractions - divide(PhanSo p2): divide 2 fractions - compare(PhanSo p2): compare 2 fractions. Returns 0 if 2 fractions are equal, 1 if 1st fraction is greater and -1 if 1st fraction is less

public class PhanSo { private float tuSo; private float mauSo; public PhanSo() { this.tuSo = 0; this.mauSo = 1; } public PhanSo(float tuSo, float mauSo) { this.tuSo = tuSo; this.mauSo = mauSo; } public float getTuSo() { return tuSo; } public void setTuSo(float tuSo) { this.tuSo = tuSo; } public float getMauSo() { return mauSo; } public void setMauSo(float mauSo) { this.mauSo = mauSo; } public PhanSo congPS(PhanSo phanSo2) { PhanSo phanSo = new PhanSo(); phanSo.tuSo = this.tuSo * phanSo2.mauSo + phan

Viết chương trình xây dựng một lớp PhanSo gồm có 2 thuộc tính là tử số (numerator) và mẫu số (denominator). Chương trình có các phương thức getter và setter cho các thuộc tính và có các chức năng sau: - reduce(): tối giản phân số - inverse(): nghịch đảo phân số - add(PhanSo p2): cộng 2 phân số - subtract(PhanSo p2): trừ 2 phân số - multiple(PhanSo p2): nhân 2 phân số - divide(PhanSo p2): chia 2 phân số - compare(PhanSo p2): so sánh 2 phân số. Trả về 0 nếu 2 phân số bằng nhau, 1 nếu phân số thứ 1 lớn hơn và -1 nếu phân số thứ nhất bé hơn trong java

public class PhanSo { private int tuSo; private int mauSo; //getter,setter public void setTuSo(int tuSo){ this.tuSo = tuSo; } public int getTuSo(){ return this.tuSo; } public void setMauSo(int mauSo){ this.mauSo = mauSo; } public int getMauSo(){ return this.mauSo; } public void reduce(){ int ucln = 1; int max = (getTuSo() > getMauSo()) ? getTuSo() : getMauSo(); for (int i = 1; i <= max; i++) { if(getTuSo() % i == 0 && getMauSo() % i == 0){ ucln = i; } } setTuSo(getTuSo() / ucln); setMauSo(getMauSo()

regex explanationMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

// Vehicle class public class Vehicle { private String name; private double value; private int cylinderCapacity; private double tax; private double taxRate; // constructor public Vehicle(String name, double value, int cylinderCapacity) { this.name = name; this.value = value; this.cylinderCapacity = cylinderCapacity; this.tax = 0; this.taxRate = 0; } // getter + setter public String getName() { return name; } public void setName(String name) { this.name = name; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } public int getCylinderCapacity() { return cylinderCapacity; } public void setCylinderCapacity(int cylinderCapacity) { this.cylinderCapacity = cylinder

fix invalid codeMon, 03 Apr 2023

package sinhviennew; import java.util.Scanner; public class SINHVIENNEW { private String HoVaTen; private String MSSV; private String lophoc; private String gioitinh; private int diemlythuyet; private int diemthuchanh; private int diemgiuaky; private int diemcuoiky; public SINHVIENNEW(String HoVaTen, String MSSV, String lophoc, String gioitinh, int diemlythuyet,int diemthuchanh,int diemgiuaky,int diemcuoiky) { this.HoVaTen = HoVaTen; this.MSSV = MSSV; this.lophoc = lophoc; this.gioitinh = gioitinh; this.diemlythuyet = 0; this.diemthuchanh = 0; this.diemgiuaky = 0; this.diemcuoiky = 0; } public void NHAPTHONGTINSV() { Scanner sc = new Scanner(System.in); System.out.println("nhập họ và tên: "); this.HoVaTen = sc.nextLine(); System.out.println("nhập Mã số sinh viên: "); this.MSSV = sc.nextLine(); System.out.println("nhập lớp học: "); this.lophoc = sc.nextLine(); System.out.println("nhập giới tính: "); this.gioitinh = sc.nextLine(); System.out.print("nhập điểm lý thuyết: "); this.diemlythuyet = sc.nextInt(); System.out.print("nhập điểm thực hành: "); this.diemthuchanh = sc.nextInt(); System.out.print("nhập điểm giữa kỳ: "); this.diemgiuaky = sc.nextInt(); System.out.print("nhập 9die6m3 cuối kỳ: "); this.diemcuoiky = sc.nextInt(); } public float TINHDIEMTB() { float d=0.0f; d+= (diemlythuyet + 0.2 + diemthuchanh * 0.2 + diemgiuaky * 0.2 + diemcuoiky * 0.4); return d; } public static void main(String[] args) { } }

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

## Important 1. a tag, img tag has a attribute "src" 2. a tag has an attribute "href" 3. input tag has an attribute "type" 4. div tag has a attribute "class" 5. div tag has a attribute "id" 6. a tag has a attribute "title" 7. h1 tag has a attribute "id" 8. p tag has a attribute "title" 9. p tag has a attribute "id" 10. br tag has a attribute "title" 11. br tag has a attribute "id" 12. b tag has a attribute "id" 13. b tag has a attribute "title" 14. b tag has a attribute "id" 15. b tag has a attribute "title" 16. div tag has a attribute "title" 17. div tag has a attribute "id" 18. body tag has a attribute "title" 19. body tag has a attribute "id" 20. button tag has a attribute "title" 21. button

fix invalid codeMon, 24 Apr 2023

import java.util.ArrayList; import java.util.Date; public class Lab6 { class giaodich { protected String maGiaoDich; protected Date ngayGiaoDich; protected double donGia; protected double soLuong; public giaodich(String maGiaoDich, Date ngayGiaoDich, double donGia, double soLuong) { this.maGiaoDich = maGiaoDich; this.ngayGiaoDich = ngayGiaoDich; this.donGia = donGia; this.soLuong = soLuong; } public double ThanhTien() { return soLuong * donGia; } } class giaodichvang extends giaodich { protected String loaiVang; public giaodichvang(String maGiaoDich, Date ngayGiaoDich, double donGia, double soLuong, String loaiVang) { super(maGiaoDich, ngayGiaoDich, donGia, soLuong); this.loaiVang = loaiVang; } } class giaodichtiente extends giaodich { public enum LoaiTienTe {VND,USD,EUR }; protected LoaiTienTe loaiTienTe; protected double tiGia; public giaodichtiente(String maGiaoDich, Date ngayGiaoDich, double donGia, double soLuong, LoaiTienTe loaiTienTe, double tiGia) { super(maGiaoDich, ngayGiaoDich, donGia, soLuong); this.loaiTienTe = loaiTienTe; this.tiGia = tiGia; } @Override public double ThanhTien() { if (loaiTienTe == LoaiTienTe.VND) { return super.ThanhTien(); } else { return soLuong * donGia * tiGia; } } } class quanlygiaodich { protected ArrayList<giaodich> dsGiaoDich = new ArrayList<>(); public void themGiaoDich(giaodich gd) { dsGiaoDich.add(gd); } public void xuatDanhSachGiaoDich() { for (giaodich gd : dsGiaoDich) { System.out.println(gd.maGiaoDich + "-" + gd.ngayGiaoDich + "-" + gd.donGia + "-" + gd.soLuong); } } public double TongSoLuongVang() { double tongSoLuong = 0; for (giaodich gd : dsGiaoDich) { if (gd instanceof giaodichvang) { tongSoLuong += gd.soLuong; } } return tongSoLuong; } public double TongSoLuongTienTe(giaodichtiente.LoaiTienTe loaiTienTe) { double tongSoLuong = 0; for (giaodich gd : dsGiaoDich) { if (gd instanceof giaodichtiente && ((giaodichtiente) gd).loaiTienTe == loaiTienTe) { tongSoLuong += gd.soLuong; } } return tongSoLuong; } public double TrungBinhThanhTien() { double tongThanhTien = 0; int soGiaoDichTienTe = 0; return 0; } public void giaodichcodongialonhon1ty() { for (giaodich gd : dsGiaoDich) { if (gd.donGia > 1000000000) { System.out.println(gd.maGiaoDich + "-" + gd.ngayGiaoDich + "-" + gd.donGia + "-" + gd.soLuong); } } } public class Main { public static void main(String[] args) { quanlygiaodich qlgd = new quanlygiaodich(); String maGiaoDich = "GD001"; Date ngayGiaoDich = new Date(2023, 4, 24); double donGia = 5000000; double soLuong = 10; String loaiVang = "18K"; qlgd.xuatDanhSachGiaoDich(); } } } }

class from descriptionMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

class SinhVien { String name, String masv, String namsinh, String diem; int diemthi; int diemthuchanh; int diemgiuaki; int diemcuoiki; public SinhVien() { this.diemthi = 0; this.diemthuchanh = 0; this.diemgiuaki = 0; this.diemcuoiki = 0; } public SinhVien(String name, String masv, String namsinh, int diemthi, int diemthuchanh, int diemgiuaki, int diemcuoiki) { this.name = name; this.masv = masv; this.namsinh = namsinh; this.diemthi = diemthi; this.diemthuchanh = diemthuchanh; this.di

Java
View
docstringMon, 27 Mar 2023

Write a program to build a class PhanSo that has 2 properties, numerator and denominator. The program has getter and setter methods for properties and has the following functions: - reduce(): minimize fractions - inverse(): inverse fraction - add(PhanSo p2): add 2 fractions - subtract(PhanSo p2): subtract 2 fractions - multiple(PhanSo p2): multiply 2 fractions - divide(PhanSo p2): divide 2 fractions - compare(PhanSo p2): compare 2 fractions. Returns 0 if 2 fractions are equal, 1 if 1st fraction is greater and -1 if 1st fraction is less

class PhanSo: def __init__(self, tu, mau): """Initializing""" self.tu = tu self.mau = mau def setTu(self, tu): """Setter for tu""" self.tu = tu def getTu(self): """Getter for tu""" return self.tu def setMau(self, mau): """Setter for mau""" self.mau = mau def getMau(self): """Getter for mau""" return self.mau def __str__(self): """Print""" return str(self.tu) + "/" + str(self.mau) def __repr__(self): """Return a string representation of the fraction for interactive mode.""" return 'PhanSo({0}, {1})'.format(self.tu, self.mau) def __add__(self, p2

class from descriptionMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

class Vehicle { private String vehicleName; private int cylinderCapacity; private double price; public Vehicle() { } public Vehicle(String vehicleName, int cylinderCapacity, double price) { this.vehicleName = vehicleName; this.cylinderCapacity = cylinderCapacity; this.price = price; } public String getVehicleName() { return vehicleName; } public void setVehicleName(String vehicleName) { this.vehicleName = vehicleName; } public int getCylinderCapacity() { return cylinderCapacity; } public void setCylinderCapacity(int cylinderCapacity) { this.cylinderCapacity = cylinderCapacity; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public double get

Java
View
code to explanationMon, 27 Mar 2023

Write a program to calculate the result of the formula pi in java 𝜋=4(1−1/3+1/5−1/7+1/9−1/11+1/13−⋯−1/2𝑖−1+1/2𝑖+1) with 10000 ≤ i ≤ 100000

public class Pi { public static void main(String[] args) { double pi = 0.0; System.out.println("i m(i)"); System.out.println("-----------------------"); for (int i = 10000; i <= 100000; i += 10000) { pi = 0.0; for (int j = 1; j <= i; j++) { if (j % 2 == 0) { pi += 1.0 / (2 * j - 1); } else { pi -= 1.0 / (2 * j - 1); } } pi *= 4.0; System.out.printf("%d\t\t%10.4f\n", i, pi); } } }

time complexityMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

O(n)

testsMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

import java.util.Scanner; class Vehicle { private String name; private String colour; private String registration; private String manufacturer; private int weight; private int displacement; private int price; Scanner sc = new Scanner(System.in); public Vehicle() { } public Vehicle(String name, String colour, String registration, String manufacturer, int weight, int displacement, int price) { this.name = name; this.colour = colour; this.registration = registration; this.manufacturer = manufacturer; this.weight = weight; this.displacement = displacement; this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getColour() { return colour; } public void set

typingsMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

public class SinhVien { private String hoTen; private int tuoi; private float diemHoa; private float diemLy; private float diemToan; private float diemTB; private float diemTB2; public SinhVien(String hoTen, int tuoi, float diemHoa, float diemLy, float diemToan, float diemTB, float diemTB2) { this.hoTen = hoTen; this.tuoi = tuoi; this.diemHoa = diemHoa; this.diemLy = diemLy; this.diemToan = diemToan; this.diemTB = diemTB; this.diemTB2 = diemTB2; } public String getHoTen() { return hoTen; } public void setHoTen(String hoTen) { this.hoTen = hoTen; } public int

docstringMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

package bai2; /** * * @author Admin */ public class SinhVien { private String hoTen ; private int tuoi; private float diemThi; private float diemThucHanh; private float diemGiuaKy; private float diemCuoiKy; public SinhVien() { } public SinhVien(String hoTen, int tuoi, float diemThi, float diemThucHanh, float diemGiuaKy, float diemCuoiKy) { this.hoTen = hoTen; this.tuoi = tuoi; this.diemThi = diemThi; this.diemThucHanh = diemThucHanh; this.diemGiuaKy = diemGiuaKy; this.diemCuoiKy = diemCuoiKy; } public String getHoTen() { return hoTen; }

testsMon, 03 Apr 2023

package sinhviennew; import java.util.Scanner; public class SINHVIENNEW { private String HoVaTen; private String MSSV; private String lophoc; private String gioitinh; private int diemlythuyet; private int diemthuchanh; private int diemgiuaky; private int diemcuoiky; public SINHVIENNEW(String HoVaTen, String MSSV, String lophoc, String gioitinh, int diemlythuyet,int diemthuchanh,int diemgiuaky,int diemcuoiky) { this.HoVaTen = HoVaTen; this.MSSV = MSSV; this.lophoc = lophoc; this.gioitinh = gioitinh; this.diemlythuyet = 0; this.diemthuchanh = 0; this.diemgiuaky = 0; this.diemcuoiky = 0; } public void NHAPTHONGTINSV() { Scanner sc = new Scanner(System.in); System.out.println("nhập họ và tên: "); this.HoVaTen = sc.nextLine(); System.out.println("nhập Mã số sinh viên: "); this.MSSV = sc.nextLine(); System.out.println("nhập lớp học: "); this.lophoc = sc.nextLine(); System.out.println("nhập giới tính: "); this.gioitinh = sc.nextLine(); System.out.print("nhập điểm lý thuyết: "); this.diemlythuyet = sc.nextInt(); System.out.print("nhập điểm thực hành: "); this.diemthuchanh = sc.nextInt(); System.out.print("nhập điểm giữa kỳ: "); this.diemgiuaky = sc.nextInt(); System.out.print("nhập 9die6m3 cuối kỳ: "); this.diemcuoiky = sc.nextInt(); } public float TINHDIEMTB() { float d=0.0f; d+= (diemlythuyet + 0.2 + diemthuchanh * 0.2 + diemgiuaky * 0.2 + diemcuoiky * 0.4); return d; } }

### Test with JUnit

metaMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

<meta name="keywords" content="Department, Transport, monitor, registration, people, vehicle, price, information, cylinder, capacity, vehicle, Department, Transport, calculate, environmental, tax, paid, advance, buying, car, 100cc, 1, vehicle, 100, 200cc, 3, car, 200cc, 5, car, implement, Vehicle, class, manage, vehicle, attributes, suitable, method, class, constructors, inclusive, encapsulation, create, xe1, xe2, xe3, objects, Vehicle, class, Enter, information, objects, export, registration, tax, declaration, sheet, vehicle, java">

typingsMon, 03 Apr 2023

Viết chương trình xây dựng một lớp PhanSo gồm có 2 thuộc tính là tử số (numerator) và mẫu số (denominator). Chương trình có các phương thức getter và setter cho các thuộc tính và có các chức năng sau: - reduce(): tối giản phân số - inverse(): nghịch đảo phân số - add(PhanSo p2): cộng 2 phân số - subtract(PhanSo p2): trừ 2 phân số - multiple(PhanSo p2): nhân 2 phân số - divide(PhanSo p2): chia 2 phân số - compare(PhanSo p2): so sánh 2 phân số. Trả về 0 nếu 2 phân số bằng nhau, 1 nếu phân số thứ 1 lớn hơn và -1 nếu phân số thứ nhất bé hơn trong java

public class PhanSo { int numerator; int denominator; PhanSo(int numerator, int denominator) { this.numerator = numerator; this.denominator = denominator; } public int getNumerator() { return this.numerator; } public int getDenominator() { return this.denominator; } public void setNumerator(int numerator) { this.numerator = numerator; } public void setDenominator(int denominator) { this.denominator = denominator; } public void reduce() { int ucln = this.numerator; int bcnn = this.denominator; while (ucln != bcnn) { if (ucln > bcnn) { ucln -= bcnn; } else { bcnn -= ucln; } } this.numer

fix invalid codeMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

#include <iostream> using namespace std; class Vehicle{ private: string name; string color; string number; double price; int cylinder; public: Vehicle( string name, string color, string number, double price, int cylinder){ this->name = name; this->color = color; this->number = number; this->price = price; this->cylinder = cylinder; } Vehicle(){ this->name = ""; this->color = ""; this->number = ""; this->price = 0; this->cylinder = 0; } double tax(){ if(this->cylinder <= 100){ return this->price * 1 / 100; } else if(this->cylinder <= 200){ return this->price * 3 / 100; } else{ return this->price * 5 / 100; } } void print(){ cout <<

css from descriptionMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

class Vehicle { private String name; private String capacity; private String value; public Vehicle(String name, String capacity, String value) { this.name = name; this.capacity = capacity; this.value = value; } public double tinhThue() { double thue = 0; int cap = Integer.parseInt(this.capacity); double val = Double.parseDouble(this.value); if(cap < 100) thue = val*0.01; if(cap >= 100 && cap<200) thue = val*0.03; if(cap >= 200) thue = val*0.05; return thue; } public void display() { System.out.println("Ten xe: "+this.name); System.out.println("Dung tich xe: "+this.capacity); System.out.println("Gia xe: "+this.value); System.out.println("Thue: "+

text to sql syntaxMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0 Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all member properties of the object in java

import java.io.*; import java.util.*; public class SinhVien { private String name; private int age; private double point; private int ID; private int Theory; private int practice; private int midterm; private int final_exam; private double average; public SinhVien(String name, int age, double point, int ID, int Theory, int practice, int midterm, int final_exam) { this.name = name; this.age = age; this.point = point; this.ID = ID; this.Theory = Theory; this.practice = practice; this.midterm = midterm; this.final_exam = final_exam; } public SinhVien() { } public String getName() { return name; } public void setName(String name) { this.

linuxMon, 03 Apr 2023

Viết chương trình xây dựng một lớp PhanSo gồm có 2 thuộc tính là tử số (numerator) và mẫu số (denominator). Chương trình có các phương thức getter và setter cho các thuộc tính và có các chức năng sau: - reduce(): tối giản phân số - inverse(): nghịch đảo phân số - add(PhanSo p2): cộng 2 phân số - subtract(PhanSo p2): trừ 2 phân số - multiple(PhanSo p2): nhân 2 phân số - divide(PhanSo p2): chia 2 phân số - compare(PhanSo p2): so sánh 2 phân số. Trả về 0 nếu 2 phân số bằng nhau, 1 nếu phân số thứ 1 lớn hơn và -1 nếu phân số thứ nhất bé hơn trong java

package PhanSo; import java.util.Scanner; public class PhanSo { private int numerator; private int denominator; public PhanSo() { } public PhanSo(int numerator, int denominator) { this.numerator = numerator; this.denominator = denominator; } public int getNumerator() { return numerator; } public void setNumerator(int numerator) { this.numerator = numerator; } public int getDenominator() { return denominator; } public void setDenominator(int denominator) { this.denominator = denominator; } @Override public String toString() { return "PhanSo{" + "numerator=" + numerator + ", denominator=" + denominator + '}'; } public void reduce(){ int ucln = 1

language from codeMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

The following is the format for the code:

text to sql syntaxMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0 Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all member properties of the object.

class SinhVien: def __init__(self, ho_ten, nam_sinh, lop, diem_toan, diem_ly, diem_hoa, diem_thi_thuc_hanh, diem_thi_thuyet ): self.ho_ten = ho_ten self.nam_sinh = nam_sinh self.lop = lop self.diem_toan = diem_toan self.diem_ly = diem_ly self.diem_hoa = diem_hoa self.diem_thi_thuc_hanh = diem_thi_thuc_hanh self.diem_thi_thuyet = diem_thi_thuyet def get_ho_ten(self): return self.ho_ten def get_nam_sinh(self): return self.nam_sinh def get_lop(self): return

regex explanationMon, 03 Apr 2023

Viết chương trình xây dựng một lớp PhanSo gồm có 2 thuộc tính là tử số (numerator) và mẫu số (denominator). Chương trình có các phương thức getter và setter cho các thuộc tính và có các chức năng sau: - reduce(): tối giản phân số - inverse(): nghịch đảo phân số - add(PhanSo p2): cộng 2 phân số - subtract(PhanSo p2): trừ 2 phân số - multiple(PhanSo p2): nhân 2 phân số - divide(PhanSo p2): chia 2 phân số - compare(PhanSo p2): so sánh 2 phân số. Trả về 0 nếu 2 phân số bằng nhau, 1 nếu phân số thứ 1 lớn hơn và -1 nếu phân số thứ nhất bé hơn trong java

java public class PhanSo { private int tuSo; private int mauSo; public PhanSo(){ tuSo=0; mauSo=0; } public PhanSo(int tuSo,int mauSo){ this.tuSo=tuSo; this.mauSo=mauSo; } public int getTuSo(){ return this.tuSo; } public void setTuSo(int tuSo){ this.tuSo=tuSo; } public int getMauSo(){ return this.mauSo; } public void setMauSo(int mauSo){ this.mauSo=mauSo; } public void reduce(){ int tuSo=this.tuSo; int mauSo=this.mauSo; while(Math.abs(tuSo)!=Math.abs(mauSo)){ if(tuSo>mauSo){ tu

generate functionMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

private String tenXe; private int dungTich; private int gia; private String hangXe; private String maSoXe; private int thuePhi; private boolean isThuePhi; public Vehicle(String tenXe, int dungTich, int gia, String hangXe, String maSoXe, int thuePhi, boolean isThuePhi) { this.tenXe = tenXe; this.dungTich = dungTich; this.gia = gia; this.hangXe = hangXe; this.maSoXe = maSoXe; this.thuePhi = thuePhi; this.isThuePhi = isThuePhi; } public String getTenXe() { return tenXe; } public void setTenXe(String tenXe) { this.tenXe = tenXe; } public int getDungTich()

Java
View
text to sql syntaxMon, 10 Apr 2023

write a program about the Department of Transport that needs to monitor the registration of people's vehicles. Based on price information and cylinder capacity of the vehicle, the Department of Transport will calculate the environmental tax to be paid in advance When buying a car as follows: - Under 100cc, 1% of the vehicle value - From 100 to 200cc, 3% of the car's value - Over 200cc, 5% of the car's value Design and implement the Vehicle class to manage vehicle attributes and suitable method. The class must have constructors and must be inclusive encapsulation Then let's create a few xe1, xe2, xe3 objects of the Vehicle class in a chapter other program. Enter information for these objects and export the registration tax declaration sheet of each vehicle in java

class Vehicle { private int numberOfCylinders; private int price; private int tax; public Vehicle() { this.numberOfCylinders = 0; this.price = 0; this.tax = 0; } public Vehicle(int numberOfCylinders, int price) { this.numberOfCylinders = numberOfCylinders; this.price = price; } public int getNumberOfCylinders() { return numberOfCylinders; } public void setNumberOfCylinders(int numberOfCylinders) { this.numberOfCylinders = numberOfCylinders; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public int getTax() { if(getNumberOfCylinders() < 100) { this.tax = getPrice() * 1 / 100; } else if

testsMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

import unittest class TestTinhDiemTB(unittest.TestCase): def test_tinhDiemTB(self): self.assertEqual(tinhDiemTB(10, 5, 3, 6), 5.6)

fix invalid codeMon, 27 Mar 2023

Write a program to calculate the result of the formula pi in java 𝜋=4(1−1/3+1/5−1/7+1/9−1/11+1/13−⋯−1/2𝑖−1+1/2𝑖+1) with 10000 ≤ i ≤ 100000

java import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); double pi = 0; for(int i=1; i<=n; i++) { if(i%2==0) { pi = pi - (1.0/(2*i-1)); } else { pi = pi + (1.0/(2*i-1)); } } pi = 4 * pi; System.out.println(pi); } }

generate functionMon, 27 Mar 2023

let's build a class SinhVien with the attributes of students created by them come up with (must list at least 3 properties), in addition the class has 4 more properties about The scores are: theory score, practical score, midterm (exam) score and final (exam) score. Besides, when any student object has just been created, the initial value of the score columns are equal to 0. Then write a program that uses the above student class and has the functions data entry for students (enter values for attributes); calculate the average score of students members (20% theory + 20% practice + 20% midterm + 40% final) and information export of students on the screen. In addition, the program must have getter and setter methods to get and set the value for all object member properties in java

class Student { //properties of student int id; String name; String address; double theoryScore; double practiceScore; double midtermScore; double finalScore; //constructor Student(int id, String name, String address, double theoryScore, double practiceScore, double midtermScore, double finalScore) { this.id = id; this.name = name; this.address = address; this.theoryScore = theoryScore; this.practiceScore = practiceScore; this.midtermScore = midtermScore; this.finalScore = finalScore; } //getter and setter methods int getID() { return id; } void setID(int id) { this.id = id; } String getName() { return name; } void setName(String name) { this.name = name; } String

Java
View
fix invalid codeMon, 03 Apr 2023

Viết chương trình xây dựng một lớp PhanSo gồm có 2 thuộc tính là tử số (numerator) và mẫu số (denominator). Chương trình có các phương thức getter và setter cho các thuộc tính và có các chức năng sau: - reduce(): tối giản phân số - inverse(): nghịch đảo phân số - add(PhanSo p2): cộng 2 phân số - subtract(PhanSo p2): trừ 2 phân số - multiple(PhanSo p2): nhân 2 phân số - divide(PhanSo p2): chia 2 phân số - compare(PhanSo p2): so sánh 2 phân số. Trả về 0 nếu 2 phân số bằng nhau, 1 nếu phân số thứ 1 lớn hơn và -1 nếu phân số thứ nhất bé hơn trong java

public int compare(PhanSo p2) { if (this.tich(p2) == this.tong(p2)) return 0; else if (this.tich(p2) > this.tong(p2)) return 1; else return -1; }

Questions about programming?Chat with your personal AI assistant