herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你的BMI
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
請用 C/C++/java寫一簡易程式
-
BMI (Body Mass Index)= 體重 (kg) / 身高 ^2(m 2 ) 在台灣,行政院衛生署乃根據其相關研究,於2002年4月公佈台灣成人肥胖標準: BMI<18.5 為過輕, 18.5≦BMI<24 為正常體重, 24≦BMI<27 為過重, BM...
-
33, 45, 87, 99, 27 算平均
-
需要練習的Java程式:
-
一、 試利用switch case由程式中直接輸入一個1~7 之間的整數day,代表星期一到星期日。若day 的值是1,則印出 "星期一",若day 的值是2,則印出 "星期二",若day 的值是7,則印出 "星期日",...
-
用 C/C++算上學期加權平均
56 則留言:
public class hw2 {
public static void main(String[] args) {
int x[]={76,75,85,81,95,87,70,95,83,66};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
public class ex2 {
public static void main(String[] args) {
int x[]={90,83,82,70,82,74,91,81,60,92,70,72};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/12.0);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={87,90,83,83,84,85,91,84,61,94,83,86};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/12.0);
}
}
package ex1;
public class exb {
public static void main(String[] args) {
int x[]={88,90,68,76,76,76,66,89,82,85};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package ex1;
public class exb {
public static void main(String[] args) {
int x[]={88,70,68,70,66,76,66,79,82,85};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={62,70,45,80,60,60,64,78,70,65};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
public class ex01 {
public static void main(String[] args) {
int x[]={78,85,60,77,71,67,70,86,81,68};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
package hw2;
public class ex3 {
public static void main(String[] args) {
int a=80 ;
int b=79 ;
int c=75 ;
int d=70 ;
int e=80 ;
int f=65 ;
int g=84 ;
int h=90 ;
int i=95 ;
int sum=(a+b+c)*2;
int sum1=(d+e+f)*3;
int sum2=(g+h+i)*4;
System.out.println((sum+sum1+sum2)/27.0);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={80,93,77,78,91,88,60,94,67,80};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
package W2;
import java.util.Scanner;
public class hw3 {
public static void main(String[] args) {
int a[] = new int [5];
Scanner x = new Scanner(System.in);
for(int i =0; i<a.length; i++){
System.out.println("請輸入第"+i+"數字");
a[i] = x.nextInt();
}
int m= a[0];
for (int i =0; i<a.length;i++){
m=(a[0]*1)+(a[1]*3)+(a[2]*2)+(a[3]*4)+(a[4]*2);
}
System.out.println("加總成績="+m);
System.out.println("加總平均成績="+m/12.0);
}
}
import java.util.Scanner;
public class ex01 {
public static void main(String[] args) {
int a[]=new int [5];
Scanner x=new Scanner(System.in);
for (int i = 0; i
System.out.println("輸入數值"+i+"分數");
a[i]=x.nextInt();
}
int m=a[0];
for (int i = 0; i < a.length; i++) {
m=(a[0]*2)+(a[1]*4)+(a[2]*3)+(a[3]*4)+(a[4]*2);
}
System.out.println("加權平均="+m/15.0);
}
}
public class ex4 {
public static void main(String[] args) {
int s[]={82, 60, 60, 97, 66, 66, 60, 76, 89, 60, 68};
int c[]={0, 2, 2, 2, 3, 2, 2, 3, 2, 0, 0};
float result=0;
float sum_c=0;
double ans;
for(int i=0; i<s.length; i++){
result+=s[i]*c[i];
sum_c+=c[i];
}
ans=result/sum_c;
System.out.printf("%.1f", ans);
}
}
public static void main(String[] args) {
int x[]={82,80,74,60,62,65,60,72,68,85};
int sum=0;
for(int a:x)
sum+=a;
System.out.print(sum);
System.out.print(sum/22.0);
}
}
public class ex4
{
public static void main(String[] args)
{
int A[]={88,90,92,91,80,96,91,98,91,90,80};
int B[]={0,2,2,2,3,2,2,3,2,0,0};
int sum_x=0,sum_y=0;
for(int i=0; i<A.length;i++)
{
sum_x+=A[i]*B[i];
sum_y+=B[i];
}
System.out.println("加權平均數 = "+(float)sum_x/sum_y);
}
}
加權平均數 =90.888885
public class ex1 {
public static void main(String[] args) {
int A=84;
int B=90;
int C=100;
int D=77;
int E=91;
int F=72;
int G=87;
int H=79;
double a=(A+B+C+D)*2.0;
double b=(E+F+G)*3.0;
double c=(H)*4.0;
System.out.println((a+b+c)/21);
}
}
public class hw1 {
public static void main(String[] args) {
int x[]={66,76,88,73,98,99,76,90,90,87,76,77};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/12.0);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={68,78,85,89,60,67,60,72,62,84};
int sum=0;
for(int a:x)
sum+=a;
System.out.print(sum);
System.out.print(sum/10.0);
}
}
public class ex02 {
public static void main(String[] args) {
int A=76;
int B=72;
int C=82;
int D=94;
int E=75;
int F=74;
int G=75;
int H=77;
double a=(A+B+C+D)*2.0;
double b=(E+F+G)*3.0;
double c=(H)*4.0;
System.out.println((a+b+c)/21);
}
}
public class ex02 {
public static void main(String[] args) {
int A=76;
int B=72;
int C=82;
int D=94;
int E=75;
int F=74;
int G=75;
int H=77;
double a=(A+B+C+D)*2.0;
double b=(E+F+G)*3.0;
double c=(H)*4.0;
System.out.println((a+b+c)/21);
}
}
public class eeeee {
public static void main(String[] args) {
int scores[]={77,63,72,81,80,68,78,66,69,70};
int credits[]={3,0,2,3,3,2,1,3,3,0};
int c=0, Sum=0;
for(int i=0;i<5;i++){
Sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)Sum/c);
}
}
package b2;
public class P3 {
public static void main(String[] args) {
int scores[]={76,88,70,85,83,72};
int credits[]={2,3,4,3,2,3};
int c=0,sum=0;
for(int i=0;i<5;i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)sum/c);
}
}
public class ex4
{
public static void main(String[] args)
{
int A[]={88,90,92,91,80,96,91,98,91,90,80};
int B[]={0,2,2,2,3,2,2,3,2,0,0};
int sum_x=0,sum_y=0;
for(int i=0; i<A.length;i++)
{
sum_x+=A[i]*B[i];
sum_y+=B[i];
}
System.out.println("加權平均數 = "+(float)sum_x/sum_y);
}
}
public class EX04 {
public static void main(String[] args) {
int scores[]={68, 78, 85, 89, 60, 67, 60, 72, 62, 84};
int credits[]={1, 2, 2, 3, 3, 3, 3, 1, 3, 0};
int c=0, sum=0;
for(int i=0; i<10; i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.print((double)sum/c);
public class ex1 {
public static void main(String[] args) {
int A=84;
int B=90;
int C=100;
int D=97;
int E=91;
int F=92;
int G=87;
int H=90;
double a=(A+B+C+D)*2.0;
double b=(E+F+G)*3.0;
double c=(H)*4.0;
System.out.println((a+b+c)/21);
}
}
public class EX04 {
public static void main(String[] args) {
int scores[]={82, 80, 74, 62, 62, 65, 60, 72, 68, 85};
int credits[]={1, 2, 3, 3, 3, 3, 3, 1, 3, 0};
int c=0, sum=0;
for(int i=0; i<10; i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.print((double)sum/c);
public class HW2 {
public static void main(String[] args) {
int scores[]={11,67,89,76};
int credits[]={2,3,4,2};
int c=0,sum=0;
for(int i=0;i<4;i++){
sum+=credits[i]*scores[i];
c+=credits[i];
public class ex2 {
public static void main(String[] args) {
int scores[]={77,67,89,76};
int credits[]={2, 3, 4, 2};
int c=0, sum=0;
for(int i=0; i<4; i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)sum/c);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={80,93,77,78,91,88,60,94,67,80};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
public class hw2 {
public static void main(String[] args) {
int scores[]={77,67,89,76};
int credits[]={2,3,4,2};
int c=0,sum=0;
for(int i=0; i<4;i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)sum/c);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={68,78,85,89,60,67,60,72,62,84};
int sum=0;
for(int a:x)
sum+=a;
System.out.print(sum);
System.out.print(sum/10.0);
}
}
package date1;
public class ex00000 {
public static void main(String[] args) {
int number=0;
int sum=0;
int x[]={85,88,82,77,72,75,65,81,67,70};
int y[]={2,2,2,3,2,2,3,2,0,0};
for(int i=0; i<x.length; i++){
number += x[i]*y[i];
sum += y[i];
}
System.out.println("加權平均:"+ number/sum);
System.out.println("學期總分:"+ sum);
}
}
public class EX2 {
public static void main(String[] args) {
int scores[]={77,67,89,76};
int credits[]={2,3,4,2};
int c=0, sum=0;
for(int i=0; i<4; i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)sum/c);
}
}
package date1;
public class ex00000 {
public static void main(String[] args) {
int number=0;
int sum=0;
int x[]={85,88,82,77,72,75,65,81,67,70};
int y[]={2,2,2,3,2,2,3,2,0,0};
for(int i=0; i<x.length; i++){
number += x[i]*y[i];
sum += y[i];
}
System.out.println("加權平均:"+ number/sum);
System.out.println("學期總分:"+ sum);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={68,78,85,89,60,67,60,72,62,84};
int sum=0;
for(int a:x)
sum+=a;
System.out.print(sum);
System.out.print(sum/10.0);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={85,78,76,80,85,80,76,77,62};
int sum=0;
for(int a:x)
sum+=a;
System.out.print(sum);
System.out.print(sum/9.0);
}
}
public class ex4
{
public static void main(String[] args)
{
int A[]={88,90,92,91,80,96,91,98,91,90,80};
int B[]={0,2,2,2,3,2,2,3,2,0,0};
int sum_x=0,sum_y=0;
for(int i=0; i<A.length;i++)
{
sum_x+=A[i]*B[i];
sum_y+=B[i];
}
System.out.println("加權平均數 = "+(float)sum_x/sum_y);
}
}
public class hw2 {
public static void main(String[] args) {
int x[]={80,93,77,78,91,88,60,94,67,80};
int sum=0;
for(int a:x)
sum+=a;
System.out.println(sum);
System.out.println(sum/10.0);
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package b2;
public class P3 {
public static void main(String[] args) {
int scores[]={76,88,70,85,83,72};
int credits[]={2,3,4,3,2,3};
int c=0,sum=0;
for(int i=0;i<5;i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)sum/c);
}
}
public class ex4
{
public static void main(String[] args)
{
int A[]={88,90,92,91,80,96,91,98,91,90,80};
int B[]={0,2,2,2,3,2,2,3,2,0,0};
int sum_x=0,sum_y=0;
for(int i=0; i<A.length;i++)
{
sum_x+=A[i]*B[i];
sum_y+=B[i];
}
System.out.println("加權平均數 = "+(float)sum_x/sum_y);
}
}
public class ex1{
public static void main(String[] args) {
int number=0;
int sum=0;
int x[]={85,88,82,77,72,75,65,81,67,70};
int y[]={2,2,2,3,2,2,3,2,0,0};
for(int i=0; i<x.length; i++){
number += x[i]*y[i];
sum += y[i];
}
System.out.println("加權平均:"+ number/sum);
System.out.println("學期總分:"+ sum);
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
public class EX2 {
public static void main(String[] args) {
int scores[]={77,67,89,76};
int credits[]={2,3,4,2};
int c=0, sum=0;
for(int i=0; i<4; i++){
sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)sum/c);
}
}
public class eeeee {
public static void main(String[] args) {
int scores[]={77,63,72,81,80,68,78,66,69,70};
int credits[]={3,0,2,3,3,2,1,3,3,0};
int c=0, Sum=0;
for(int i=0;i<5;i++){
Sum+=credits[i]*scores[i];
c+=credits[i];
}
System.out.println((double)Sum/c);
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
public class ex1{
public static void main(String[] args) {
int number=0;
int sum=0;
int x[]={85,88,82,77,72,75,65,81,67,70};
int y[]={2,2,2,3,2,2,3,2,0,0};
for(int i=0; i<x.length; i++){
number += x[i]*y[i];
sum += y[i];
}
System.out.println("加權平均:"+ number/sum);
System.out.println("學期總分:"+ sum);
}
}
package hw2;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) {
int a[]=new int [5];
int b[]=new int [5];
Scanner input=new Scanner(System.in);
for (int i=0; i<=4;i++){
System.out.println("輸入期末成績=");
a[i] = input.nextInt();
System.out.println("輸入學分數=");
b[i] = input.nextInt();
int sum=a[i]*b[i];
System.out.println("加權分數="+sum);
{
for(int x=0;x<=0;x++){
int sum1=0;
sum1+=sum;
System.out.println("加權平均分數="+sum1/3.0);
}
}
}
}
}
張貼留言