/*
* @ (#) Card
*
* Copyright 2008 School of software, Yunnan University.
* All Rights Reserved
*/
Package cn.edu. ynu. Sei. java_homework.hw1.part1;
/**
* Java job 1, part 1
* @ Version 1.0.0.0 Feb 25,200 8
* @ Author eleven
*/
Public class card {
Public void card (string name, string address, string email, string phone ){
System. Out. println ("--------------------------------");
System. Out. println ("name:" + name );
System. Out. println ("Address:" + address );
System. Out. println ("Email:" + email );
System. Out. println ("Phone:" + phone );
System. Out. println ("--------------------------------");
}
Public static void main (string [] ARGs ){
Card = new card ();
Card. Card ("Eleven", "software School, Yunnan University", "eleven026@gmail.com", "12888546307 ");
}
}
/*
* @ (#) Computeinterest
*
* Copyright 2008 School of software, Yunnan University.
* All Rights Reserved
*/
Package cn.edu. ynu. Sei. java_homework.hw1.part2;
/**
* Java daily job, the first part of 2nd, calculate the interest
* @ Version 1.0.0.0 Feb 25,200 8
* @ Author eleven
*/
Public class computeinterest {
Private double maid = 0.05;
Private Static double balance;
Public computeinterest (){
System. Out. println ("-------------------------------------------------------------");
System. Out. println ("the balance is" + balance );
System. Out. println ("---");
Double newbalance_year1 = balance * (1 + interestrate );
System. Out. println ("the balance at the end of the first year is" + newbalance_year1 );
Double newbalance_year2 = newbalance_year1 * (1 + interestrate );
System. Out. println ("the balance at the end of the second year is" + newbalance_year2 );
Double newbalance_year3 = newbalance_year2 * (1 + interestrate );
System. Out. println ("the balance at the end of the third year is" + newbalance_year3 );
Double newbalance_year4 = newbalance_year3 * (1 + interestrate );
System. Out. println ("the balance at the end of the Forth Year is" + newbalance_year4 );
Double newbalance_year5 = newbalance_year4 * (1 + interestrate );
System. Out. println ("the balance at the end of the previous th year is" + newbalance_year5 );
System. Out. println ("-------------------------------------------------------------");
}
Public static void main (string [] ARGs ){
Balance = 10000;
Computeinterest = new computeinterest ();
}
}
/*
* @ (#) Primegenerator
*
* Copyright 2008 School of software, Yunnan University.
* All Rights Reserved
*/
Package cn.edu. ynu. Sei. java_homework.hw1.part3;
/**
* For Java jobs, part 1 of the first time generates prime numbers.
* @ Version 1.0.0.0 Mar 11,200 8
* @ Author eleven
*/
Public class primegenerator {
/**
* Determine and generate prime numbers based on the given starting number
*/
Public int isprime (INT number ){
Int returnvalue = 0;
If (number = 2 ){
Returnvalue = 1;
} Else {
For (INT I = 2; I <number; I ++ ){
If (Number % I! = 0 ){
Returnvalue = 1;
} Else {
Returnvalue = 0;
Break;
}
}
}
Return returnvalue;
}
}
/*
* @ (#) Getprime
*
* Copyright 2008 School of software, Yunnan University.
* All Rights Reserved
*/
Package cn.edu. ynu. Sei. java_homework.hw1.part3;
Import java. util. arraylist;
Import java. util. List;
/**
* For the first Java job, Part 1 is used to obtain the prime number.
* @ Version 1.0.0.0 Mar 12,200 8
* @ Author eleven
*/
Public class getprime {
/**
* Based on the given starting number, call the isprime () method in the primegenerator class to judge all numbers between the starting numbers,
* Save the prime number to arraylist for calling the prime class.
*/
Public list getprime (INT startnumber, int endnumber ){
List primearraylist = new arraylist ();
Primegenerator = new primegenerator ();
For (INT I = startnumber; I <= endnumber; I ++ ){
If (primegenerator. isprime (I) = 1 ){
Primearraylist. Add (I );
}
}
System. Out. println ("the primes you want to get between" + startnumber + "and" + endnumber + "are ");
Return primearraylist;
}
}
/*
* @ (#) Prime
*
* Copyright 2008 School of software, Yunnan University.
* All Rights Reserved
*/
Package cn.edu. ynu. Sei. java_homework.hw1.part3;
Import java. util. List;
/**
* Java job, part 1 of the first time, Main Function
* @ Version 1.0.0.0 Mar 12,200 8
* @ Author eleven
*/
Public class prime {
Public static void main (string [] ARGs ){
Getprime = new getprime ();
List prime = getprime. getprime (1,100 );
For (Object primenumber: PRIME ){
System. Out. println (primenumber );
}
}
}