
正文
帮别人写java代码 java编程代写有哪些平台
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
求程序员帮忙写个Java代码,因为今天我有事没时间做,明天要交作业,谢谢了
代码如下,随便附一句,一定要看写的源码,我已经尽量马马虎虎的写了,你更容易看懂。
public class Test {
// 第八题
public static final int NUM = 100;
public static final double GOOD = 99.99;
public static final String CLASSNAME = "Test.Class";
public static final long MAX = 9999999;
public static void main(String[] args) {
// 第一题
byte byte1 = 1;
short short1 = 1;
int int1 = 1;
long long1 = 1;
float float1 = 1;
double double1 = 1.0;
System.out.println("byte1 - " + byte1);
System.out.println("short1 - " + short1);
System.out.println("int1 - " + int1);
System.out.println("long1 - " + long1);
System.out.println("float1 - " + float1);
System.out.println("double1 - " + double1);
// 第二题
String name;
char sex;
int age;
boolean isMember;
// 第三题
int score1;
double score2 = 98.5;
// 第四题
double f1 = 10.1, f2 = 34.2;
System.out.println("f1,f2的和:" + (f1 + f2));
System.out.println("f1,f2的差:" + (f1 - f2));
System.out.println("f1,f2的积:" + (f1 * f2));
System.out.println("f1,f2的商:" + (f1 / f2));
// 第五题
int f3 = 5;
double f4 = 45.6;
System.out.println("f3,f4的和:" + (f3 + f4));
System.out.println("f3,f4的差:" + (f3 - f4));
System.out.println("f3,f4的积:" + (f3 * f4));
System.out.println("f3,f4的商:" + (f3 / f4));
// 第六题
int A = 65;
char a = (char) A;
System.out.println("整型互转char:" + a);
// 第七题
double timor = 123.456789;
int x = Integer
.parseInt(new java.text.DecimalFormat("0").format(timor));// 四舍五入
System.out.println("double - int :" + x);
// 第八题(定义在最开始)
System.out.println("常量NUM的值: " + NUM);
System.out.println("常量GOOD的值: " + GOOD);
System.out.println("常量CLASSNAME的值: " + CLASSNAME);
System.out.println("常量MAX的值: " + MAX);
// 第九题(自定义商品类)
class Goods {
private String name;
private double price;
private int count;
private double total;
public Goods(String name, double price, int count) {
this.name = name;
this.price = price;
this.count = count;
}
public void print() {
total = price * count;
System.out.println("商品名 价格 数量 总价");
System.out.println(name + " " + price + " " + count + " "
+ total);
}
}
Goods goods = new Goods("苹果", 2, 10);
goods.print();
// 第十题
double pi = 3.14, r, d;
r = 4;
d = 2 * r;
System.out.println("圆的周长: " + (pi * d));
System.out.println("圆的面积: " + (pi * r * r));
// 第十一题
String qqname = "1234567890";
String qqpassword = "asd!#@#$%66";
Date birth = new Date(2014, 5, 1);
boolean isVIP = false;
char sex1 = '男';
StringBuilder personInfo = new StringBuilder();
personInfo.append("我是一个快乐的骚年");
personInfo
.append("然后a!#$%^*asdasdasdasdsa9d87a9s8d79asdjidauisdhausdihiasd");
// 第十二题
class Swaper {
public void change(int num1, int num2) {
int temp = num1;
num1 = num2;
num2 = temp;
System.out.printf("a=%d,b=%d\n", num1, num2);
}
}
int a1 = 2;
int b1 = 5;
Swaper swaper = new Swaper();
swaper.change(a1, b1);
}
}
相关问答
Q1: 学会java在哪帮人写代码
GitHub平台
程序员一般不是都在GitHub找项目练手帮别人写java代码,学会Java以后可以在上边进行项目练手帮别人写java代码,帮别人写代码。
Java是一门面向对象帮别人写java代码的编程语言,不仅吸收了C++语言帮别人写java代码的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的代表,极好地实现了面向对象理论,允许程序员以优雅的思维方式进行复杂的编程。
Q2: JAVA编程,帮帮忙,写一下代码
第一题:
public static final void main(String[] args) {
long sum = 0;
for (int i = 1; i = 10; i++) {
sum += factorial(i);
}
System.out.println(sum);
}
/**
* 计算阶乘
*/
public static long factorial(long n) {
if (n 0) {
throw new IllegalArgumentException("n 0");
}
if (n == 0) {
return 1L;
}
return n * factorial(n - 1);
}
第二题:使用正则表达式判断字符类型
import java.util.regex.Pattern;
public class Test {
// 判断大写字母的正则表达式
public static final Pattern P_UPPER_CASE = Pattern.compile("[A-Z]");
// 判断小写字母的正则表达式
public static final Pattern P_LOWER_CASE = Pattern.compile("[a-z]");
// 判断数字的正则表达式
public static final Pattern P_NUMBER = Pattern.compile("[0-9]");
public static final void main(String[] args) {
char[] arr = {'a', 'b', 'c', '1', 'W', '0', 'L', 'd', '8'};
int countUpper = 0;
int countLower = 0;
int countNumber = 0;
for (int i = 0; i arr.length; i++) {
String tmp = arr[i] + "";
if (P_UPPER_CASE.matcher(tmp).matches()) {
countUpper++;
} else if (P_LOWER_CASE.matcher(tmp).matches()) {
countLower++;
} else if (P_NUMBER.matcher(tmp).matches()) {
countNumber++;
}
}
System.out.println(String.format("大写字母个数:%d,小写字母个数:%d,数字个数:%d", countUpper, countLower, countNumber));
}
}
第三题:
import java.util.Scanner;
public class Test {
public static final void main(String[] args) throws InterruptedException {
Scanner in = new Scanner(System.in);
while (true) {
System.out.println("请输入温度:");
double temperature = in.nextDouble();
try {
process(temperature);
} catch (TemperatureOutofRangeException e) {
System.err.println("孵化室温度异常,请立即检查!");
}
Thread.sleep(1000);
}
}
public static void process(double temperature) throws TemperatureOutofRangeException {
if (temperature = 36 temperature = 39) {
System.out.println("孵化状态正常!");
} else {
throw new TemperatureOutofRangeException();
}
}
}
// 异常类
public class TemperatureOutofRangeException extends Exception {
public TemperatureOutofRangeException() {
super();
}
}
关于帮别人写java代码和java编程代写有哪些平台的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







