package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
final int NUMBER_OF_QUESTIONS=10;
int correctCount = 0;
int count = 0;
long startTime = System.currentTimeMillis();
String output=“”;
Scanner input = new Scanner(System.in);
while(count<NUMBER_OF_QUESTIONS)
{
int number1 = (int)(Math.random()*15);
int number2 = (int)(Math.random()*15);
System.out.print("What is “+number1+” + “+number2+”? ");
int answer = input.nextInt();
if(number1+number2==answer)
{
System.out.println(“You are correct!”);
correctCount++;
}
else
System.out.println(“Your answer is wrong.\n”+number1+" + “+number2+” should be "+(number1+number2));
count++;
output+=“\n”+number1+“+”+number2+“=”+answer+((number1+number2==answer)?" correct":" wrong");
}
long endTime = System.currentTimeMillis();
long testTime = endTime-startTime;
System.out.println(“Correct count is “+correctCount+”\nTest time is “+testTime/100+” seconds\n”+output);
}
}
================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(“千克 磅”);
for(int i=1;i<=100;i++){
System.out.printf(“%-6d%8.1f\n”, 2i-1,(2i-1)*2.2);
}
}
}
================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(“英里 千米”);
for(int i = 1;i<=10;i++){
System.out.printf(“%-11d%-6.3f\n”, i,i*1.609);
}
}
}
================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(“千克 磅 磅 千克”);
for(int i=1;i<=100;i++){
System.out.printf(“%-6d%8.1f%8d%12.2f\n”, 2i-1,(2i-1)2.2,5i+15,(5*i+15)/2.2);
}
}
}
================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(“英里 千米 千米 英里”);
for(int i=1;i<=10;i++)
System.out.printf(“%-8d%-7.3f %-8d%-6.3f\n”,i,i1.609,5i+15,(5*i+15)/1.609);
}
}
================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
int pre = 10000;
for(int i = 0;i<10;i++)
pre *= (1+0.05);
double pre1 = pre;
double sum = 0;
for(int i = 0 ;i<4;i++){
sum+=pre;
pre *= (1+0.05);
}
System.out.printf(“十年后:%.2f\n”, pre1);
System.out.printf(“总费用的四年后:%.2f\n”, sum);
}
}
================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("一共多少人数: ");
Scanner input = new Scanner(System.in);
int num = input.nextInt();
System.out.println("请着个输入名字和分数: ");
String name = “”;
double cup = 0;
for(int i = 0 ; i<num;i++){
String tname = input.next();
double tmp = input.nextDouble();
if(tmp>cup)
{
cup=tmp;
name=tname;
}
}
System.out.println(“最高分:”+name);
}
}
================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("一共多少人数: ");
Scanner input = new Scanner(System.in);
int num = input.nextInt();
System.out.println("请着个输入名字和分数: ");
String name = “”;
String name2= “”;
double cup = 0;
double cup2 = 0;
for(int i = 0 ; i<num;i++){
String tname = input.next();
double tmp = input.nextDouble();
if(tmp>cup)
{
cup2=cup;
name2=name;
cup=tmp;
name=tname;
}else if(tmp>cup2)
{
cup2=tmp;
name2=tname;
}
}
System.out.println(“最高分:”+name);
System.out.println("其次: "+name2);
}
}
=================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
public static void main(String[] args) {
// TODO Auto-generated method stub
int count=0;
int base = 0;
for(int i=100;i<=1000;i++)
{
if(i%50&&i%60)
{
count++;
System.out.print(i+" ");
}
if(count%10==0&&count!=base) {
System.out.print(“\n”);
base+=10;
}
}
}
}
=================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
总结
如果你选择了IT行业并坚定的走下去,这个方向肯定是没有一丝问题的,这是个高薪行业,但是高薪是凭自己的努力学习获取来的,这次我把P8大佬用过的一些学习笔记(pdf)都整理在本文中了
《Java中高级核心知识全面解析》
小米商场项目实战,别再担心面试没有实战项目:
=base) {
System.out.print(“\n”);
base+=10;
}
}
}
}
=================================================================
package demo;
import java.util.Scanner;
public class diwuzhang {
总结
如果你选择了IT行业并坚定的走下去,这个方向肯定是没有一丝问题的,这是个高薪行业,但是高薪是凭自己的努力学习获取来的,这次我把P8大佬用过的一些学习笔记(pdf)都整理在本文中了
《Java中高级核心知识全面解析》
[外链图片转存中…(img-NLl7BF0y-1721142965514)]
小米商场项目实战,别再担心面试没有实战项目:
[外链图片转存中…(img-3tAKhdDE-1721142965515)]