System.out.print(numberOfDollars);
if(numberOfDollars>1)
System.out.println(" dollars");
else
System.out.println(" dollar");
}
if(numberOfQuarters>0){
System.out.print(numberOfQuarters);
if(numberOfQuarters>1)
System.out.println(" quarters");
else
System.out.println(" quarter");
}
if(numberOfDimes>0){
System.out.print(numberOfDimes);
if(numberOfDimes>1)
System.out.println(" dimes");
else
System.out.println(" dime");
}
if(numberOfNickels>0){
System.out.print(numberOfNickels);
if(numberOfNickels>1)
System.out.println(" nickels");
else
System.out.println(" nickel");
}
if(numberOfPennies>0){
System.out.print(numberOfPennies);
if(numberOfPennies>1)
System.out.println(" pennies");
else
System.out.println(" penny");
}
}
}
================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
System.out.print(“Input 3 integers:”);
Scanner input = new Scanner(System.in);
int num1 = input.nextInt();
int num2 = input.nextInt();
int num3 = input.nextInt();
if(num1>num2){
int tmp = num1;
num1 = num2;
num2 = tmp;
}
if(num2>num3){
int tmp = num2;
num2 = num3;
num3 = tmp;
}
if(num1>num2){
int tmp = num1;
num1 = num2;
num2 = tmp;
}
System.out.println(num1+" “+num2+” "+num3);
}
}
================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
int sum = 0;
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
int isbnNum = input.nextInt();
int old = isbnNum;
for(int i=9;i>=1;i–){
sum+=isbnNum%10*i;
isbnNum/=10;
}
int tail = sum%11;
System.out.printf(“The ISBN-10 number is %09d”,old);
if(tail<10)
System.out.println(tail);
else
System.out.println(“X”);
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
int number1 = (int)(Math.random()*100);
int number2 = (int)(Math.random()*100);
System.out.print("What is “+number1+” + “+number2+”? ");
Scanner input = new Scanner(System.in);
int answer = input.nextInt();
if(number1+number2==answer)
System.out.println(“You are correct!”);
else{
System.out.println(“Your answer is wrong.”);
System.out.println(number1+" + “+number2+” should be "+(number1+number2));
}
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter the month number: ");
int month = input.nextInt();
System.out.print("Enter the year number: ");
int year = input.nextInt();
int[] months={31,28,31,30,31,30,31,31,30,31,30,31};
String[] monthNames={“Jan”,“Feb”,“Mar”,“Apr”,“May”,“Jun”,“Jul”,“Aug”,“Sep”,“Oct”,“Nov”,“Dec”};
boolean isLeapYear = (year%40&&year%100!=0)||(year%4000);
if(isLeapYear)
months[1]=29;
System.out.println(monthNames[month-1]+" “+year+” has “+months[month-1]+” days.");
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
System.out.print(“Enter a three-digit integer:”);
Scanner input = new Scanner(System.in);
int num = input.nextInt();
int old = num;
if(num<0)
num*=(-1);
int gewei = num%10;
int baiwei = num/100;
if(gewei==baiwei)
System.out.println(old+" is a palindrome.");
else
System.out.println(old+" is not a palindrome.");
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print(“Enter the filing status:”);
int status = input.nextInt();
System.out.print(“Enter the taxable income:”);
double income = input.nextDouble();
double tax = 0;
if(status==0){
if(income<=8350)
tax = income*0.1;
else if(income<=33950)
tax = 8350*0.1+(income-8350)*0.15;
else if(income<=82250)
tax = 8350*0.1+(33950-8350)*0.15+(income-33950)*0.25;
else if(income<=171550)
tax = 8350*0.1+(33950-8350)*0.15+(82250-33950)*0.25+(income-82250)*0.28;
else if(income<=372950)
tax = 8350*0.1+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(income-171550)*0.33;
else
tax = 8350*0.1+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(372950-171550)*0.33+(income-372950)*0.35;
}
else if(status==1) {
if (income <= 16700)
tax = income * 0.1;
else if (income <= 67900)
tax = 16700 * 0.1 + (income - 16700) * 0.15;
else if (income <= 137050)
tax = 16700 * 0.1 + (67900 - 16700) * 0.15 + (income - 67900) * 0.25;
else if (income <= 208850)
tax = 16700 * 0.1 + (67900 - 16700) * 0.15 + (137050 - 67900) * 0.25 + (income - 137050) * 0.28;
else if (income <= 372950)
tax = 16700 * 0.1 + (67900 - 16700) * 0.15 + (137050 - 67900) * 0.25 + (208850 - 137050) * 0.28 + (income - 208850) * 0.33;
else
tax = 16700 * 0.1 + (67900 - 16700) * 0.15 + (137050 - 67900) * 0.25 + (208850 - 137050) * 0.28 + (372950 - 208850) * 0.33 + (income - 372950) * 0.35;
}
else if(status==2) {
if (income <= 8350)
tax = income * 0.1;
else if (income <= 33950)
tax = 8350 * 0.1 + (income - 8350 )* 0.15;
else if (income <= 68525)
tax = 8350 * 0.1 + (33950 - 8350) * 0.15 + (income - 33950) * 0.25;
else if (income <= 104425)
tax = 8350 * 0.1 + (33950 - 8350) * 0.15 + (68525 - 33950) * 0.25 + (income - 68525) * 0.28;
else if (income <= 186475)
tax = 8350 * 0.1 + (33950 - 8350) * 0.15 + (68525 - 33950) * 0.25 + (104425 - 68525) * 0.28 + (income - 104425) * 0.33;
else
tax = 8350 * 0.1 + (33950 - 8350) * 0.15 + (68525 - 33950) * 0.25 + (104425 - 68525) * 0.28 + (186475 - 104425) * 0.33 + (income - 186475) * 0.35;
}
else if(status==3) {
if (income <= 11950)
tax = income * 0.1;
else if (income <= 45500)
tax = 11950 * 0.1 + (income - 11950 )* 0.15;
else if (income <= 117450)
tax = 11950 * 0.1 + (45500 - 11950) * 0.15 + (income - 45500) * 0.25;
else if (income <= 190200)
tax = 11950 * 0.1 + (45500 - 11950) * 0.15 + (117450 - 45500) * 0.25 + (income - 117450) * 0.28;
else if (income <= 372950)
tax = 11950 * 0.1 + (45500 - 11950) * 0.15 + (117450 - 45500) * 0.25 + (190200 - 117450) * 0.28 + (income - 190200) * 0.33;
else
tax = 11950 * 0.1 + (45500 - 11950) * 0.15 + (117450 - 45500) * 0.25 + (190200 - 117450) * 0.28 + (372950 - 190200) * 0.33 + (income - 372950) * 0.35;
}
System.out.println("Tax is "+(int)(tax*100)/100.0);
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
int coin = (int)(Math.random()*2);
System.out.print("Guess: ");
Scanner input = new Scanner(System.in);
int g = input.nextInt();
if(g==coin)
System.out.println("You are right, coin is "+coin);
else
System.out.println("You are wrong, coin is "+coin);
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
int lottery = (int)(Math.random()*1000);
int ld1 = lottery%10;
int ld2 = lottery/10%10;
int ld3 = lottery/100%10;
Scanner input = new Scanner(System.in);
System.out.print("Enter your pick: ");
int guess = input.nextInt();
int g1 = guess%10;
int g2 = guess/10%10;
int g3 = guess/100%10;
System.out.println("The lottery number is "+lottery);
if(guess==lottery)
System.out.println(“you win $10,000”);
else if((g1ld1&&g2ld3&&g3ld2)||(g1ld2&&g2ld1&&g3ld3)||(g1ld2&&g2ld3&&g3ld1)||(g1ld3&&g2ld1&&g3ld2)||(g1ld3&&g2ld2&&g3==ld1))
System.out.println(“you win $3000”);
else if(g1ld1||g1ld2||g1ld3||g2ld1||g2ld2||g2ld3||g3ld1||g3ld2||g3==ld3)
System.out.println(“you win $1000”);
else
System.out.println(“bad luck!”);
}
}
=================================================================
public class disanzhang {
public static void main(String[] args){
int x = (int)(Math.random()*100)-50;
int y = (int)(Math.random()*200)-100;
System.out.println(“The random point is (”+x+“,”+y+“)”);
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
System.out.print(“scissor(0), rock(1), paper(2):”);
Scanner input = new Scanner(System.in);
int player = input.nextInt();
int com = (int)(Math.random()*3);
String[] names = {“scissor”,“rock”,“paper”};
if(com==player)
System.out.println(“The computer is “+names[com]+”. You are “+names[player]+” too. It is a draw.”);
else{
System.out.print("The computer is “+names[com]+”. You are “+names[player]+”. You ");
String result = “”;
if((com0&&player1)||(com1&&player2)||(com2&&player0))
result=“win”;
else
result=“lose”;
System.out.println(result);
}
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
System.out.print(“Enter the weight:”);
Scanner input = new Scanner(System.in);
double w = input.nextDouble();
double c = 0;
if(w>20)
System.out.println(“the package cannot be shipped”);
else if(w<=0)
System.out.println(“Invalid input”);
else if(w<=1)
c=3.5;
else if(w<=3)
c=5.5;
else if(w<=10)
c=8.5;
else if(w<=20)
c=10.5;
if(c!=0)
System.out.println("The cost is "+c);
}
}
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
=================================================================
import java.util.Scanner;
public class disanzhang {
public static void main(String[] args){
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-01P2rJIP-1715776341114)]
[外链图片转存中…(img-UdqHN5xi-1715776341114)]
[外链图片转存中…(img-67qiPqfD-1715776341115)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!