Skip to content

Commit 472afa4

Browse files
authored
Add files via upload
1 parent d6167e2 commit 472afa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1083
-0
lines changed

Account.class

697 Bytes
Binary file not shown.

Account.ctxt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#BlueJ class context
2+
comment0.target=Account
3+
comment1.params=name\ number\ bal
4+
comment1.target=Account(java.lang.String,\ java.lang.String,\ double)
5+
comment2.params=
6+
comment2.target=java.lang.String\ getAccName()
7+
comment3.params=
8+
comment3.target=java.lang.String\ getAccNum()
9+
comment4.params=
10+
comment4.target=double\ getBal()
11+
numComments=5

Account.java

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
public class Account {
2+
private String name, number;
3+
private double bal;
4+
public Account (String name, String number, double bal) {
5+
this.name = name;
6+
this.number = number;
7+
this.bal = bal;
8+
}
9+
public String getAccName() {
10+
return this.name;
11+
}
12+
public String getAccNum() {
13+
return this.number;
14+
}
15+
public double getBal() {
16+
return this.bal;
17+
}
18+
}
19+

AccountInheritance.class

1.82 KB
Binary file not shown.

AccountInheritance.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=AccountInheritance
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

AccountInheritance.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.util.Scanner;
2+
3+
public class AccountInheritance {
4+
public static void main (String args[]) {
5+
Scanner in = new Scanner (System.in);
6+
System.out.println("Checking Account Menu");
7+
System.out.println("Input Account Name:");
8+
String name = in.nextLine();
9+
System.out.println("Input Account Number: ");
10+
String number = in.nextLine();
11+
System.out.println("Input Account Balance: ");
12+
double balance = in.nextDouble();
13+
System.out.println("Input Account Fees: ");
14+
double fees = in.nextDouble();
15+
CheckingAccount c = new CheckingAccount(name, number, balance, fees);
16+
System.out.println("Name = " + c.getAccName());
17+
System.out.println("Number = " + c.getAccNum());
18+
System.out.println("Balance = " + c.getBal());
19+
}
20+
}

CheckingAccount.class

562 Bytes
Binary file not shown.

CheckingAccount.ctxt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#BlueJ class context
2+
comment0.target=CheckingAccount
3+
comment1.params=name\ number\ bal\ fees
4+
comment1.target=CheckingAccount(java.lang.String,\ java.lang.String,\ double,\ double)
5+
comment2.params=
6+
comment2.target=double\ getBal()
7+
numComments=3

CheckingAccount.java

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class CheckingAccount extends Account {
2+
private double fees;
3+
public CheckingAccount (String name, String number, double bal, double fees) {
4+
super (name, number, bal);
5+
this.fees = fees;
6+
}
7+
public double getBal() {
8+
return super.getBal() - this.fees;
9+
}
10+
}

Circle.class

1.01 KB
Binary file not shown.

Circle.ctxt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#BlueJ class context
2+
comment0.target=Circle
3+
comment1.params=
4+
comment1.target=Circle()
5+
comment2.params=x\ y\ r
6+
comment2.target=Circle(int,\ int,\ int)
7+
comment3.params=
8+
comment3.target=int\ getX()
9+
comment4.params=
10+
comment4.target=int\ getY()
11+
comment5.params=
12+
comment5.target=int\ getR()
13+
comment6.params=x
14+
comment6.target=void\ setX(int)
15+
comment7.params=y
16+
comment7.target=void\ setY(int)
17+
comment8.params=r
18+
comment8.target=void\ setR(int)
19+
comment9.params=
20+
comment9.target=double\ getArea()
21+
numComments=10

Circle.java

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
public class Circle {
2+
private int x, y, r;
3+
public Circle() {
4+
this.x = 0;
5+
this.y = 0;
6+
this.r = 0;
7+
}
8+
9+
public Circle (int x, int y, int r) {
10+
this.x = x;
11+
this.y = y;
12+
this.r = r;
13+
}
14+
15+
public int getX() {
16+
return this.x;
17+
}
18+
19+
public int getY() {
20+
return this.y;
21+
}
22+
23+
public int getR() {
24+
return this.r;
25+
}
26+
27+
public void setX (int x) {
28+
this.x = x;
29+
}
30+
31+
public void setY (int y) {
32+
this.y = y;
33+
}
34+
35+
public void setR (int r) {
36+
this.r = r;
37+
}
38+
39+
public double getArea () {
40+
return 3.14 * this.r * this.r;
41+
}
42+
}
43+

CircleTest.class

2.09 KB
Binary file not shown.

CircleTest.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=CircleTest
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

CircleTest.java

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import java.util.Scanner;
2+
3+
public class CircleTest {
4+
public static void main(String[] args) {
5+
Scanner in = new Scanner (System.in);
6+
System.out.println("input x cords ");
7+
int x = in.nextInt();
8+
System.out.println("input y cords ");
9+
int y = in.nextInt();
10+
System.out.println("input radius ");
11+
int r = in.nextInt();
12+
Circle c = new Circle (x, y, r);
13+
System.out.println("x cords = " + c.getX());
14+
System.out.println("y cords = " + c.getY());
15+
System.out.println("radius = " + c.getR());
16+
System.out.println("The center of the Circle = (" + c.getX() + "," + c.getY() + ")" );
17+
System.out.println("area = " + c.getArea());
18+
System.out.println("changing the center and rad. of circle");
19+
System.out.println("input x cords");
20+
int d = in.nextInt();
21+
System.out.println("input y cords");
22+
int u = in.nextInt();
23+
System.out.println("input radius");
24+
int e = in.nextInt();
25+
c.setX(d);
26+
c.setY(u);
27+
c.setR(e);
28+
System.out.println("x cords = " + c.getX());
29+
System.out.println("y cords = " + c.getY());
30+
System.out.println("radius = " + c.getR());
31+
System.out.println("The center of the Circle = (" + c.getX() + "," + c.getY() + ")" );
32+
System.out.println("area = " + c.getArea());
33+
}
34+
}

CircleTestArray.class

1.69 KB
Binary file not shown.

CircleTestArray.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=CircleTestArray
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

CircleTestArray.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.util.Scanner;
2+
3+
public class CircleTestArray {
4+
public static void main(String[] args) {
5+
Scanner in = new Scanner (System.in);
6+
System.out.println("how many circles?");
7+
int size = in.nextInt();
8+
Circle c[] = new Circle[size];
9+
for (int i = 0; i < c.length; i++) {
10+
System.out.println("input next x cord for circle#" + (i + 1));
11+
int x = in.nextInt();
12+
System.out.println("input next y cord for circle#" + (i + 1));
13+
int y = in.nextInt();
14+
System.out.println("input next radius for circle#" + (i + 1));
15+
int r = in.nextInt();
16+
c[i] = new Circle(x, y, r);
17+
System.out.println("area for circle#" + (i + 1) + " = " + c[i].getArea());
18+
}
19+
}
20+
}

barclass.class

1.44 KB
Binary file not shown.

barclass.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=barclass
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

barclass.java

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.Scanner;
2+
3+
public class barclass {
4+
public static void main( String args[] ) {
5+
Scanner input = new Scanner(System.in);
6+
System.out.print("enter first number " );
7+
int number1 = input.nextInt();
8+
System.out.print("enter second number");
9+
int number2 = input.nextInt();
10+
if (number1 < number2)
11+
System.out.println(number1 + " is less than "+ number2);
12+
else if (number1 > number2)
13+
System.out.println(number1 + " is the greater than "+ number2);
14+
else if (number1 == number2)
15+
System.out.println(number1 + " is the same as "+ number2);
16+
}
17+
}

barclass1.class

1.35 KB
Binary file not shown.

barclass1.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=barclass1
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

barclass1.java

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.Scanner;
2+
3+
public class barclass1 {
4+
public static void main( String args[] ) {
5+
Scanner input = new Scanner(System.in);
6+
System.out.print("enter first number");
7+
int number1 = input.nextInt();
8+
System.out.print("enter second number");
9+
int number2 = input.nextInt();
10+
if ( (number1 % number2) == 0)
11+
System.out.print(number1 + " is a multiple of " + number2);
12+
else {
13+
System.out.print(number1 + " is a not a multiple of " + number2);
14+
}
15+
}
16+
}
17+

barclass10.class

1.57 KB
Binary file not shown.

barclass10.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=barclass10
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

barclass10.java

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.util.Scanner;
2+
3+
public class barclass10 {
4+
public static void main( String args[] ) {
5+
Scanner input = new Scanner(System.in);
6+
int total = 0;
7+
int a [] = new int [5];
8+
for (int i = 0; i < a.length; i++) {
9+
System.out.println("enter number" + (i + 1));
10+
a[i] = input.nextInt();
11+
total = total + a[i];
12+
}
13+
int average = total / a.length;
14+
System.out.println(average);
15+
for (int i : a ) {
16+
if (i < average)
17+
System.out.println(i + " is less than " + average);
18+
else {
19+
System.out.println(i + " is greater than " + average);
20+
}
21+
}
22+
}
23+
}

barclass11.class

1.6 KB
Binary file not shown.

barclass11.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=barclass11
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

barclass11.java

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.util.Scanner;
2+
3+
public class barclass11 {
4+
public static void main( String args[] ) {
5+
Scanner input = new Scanner(System.in);
6+
System.out.println("How big do you want your array? ");
7+
int found = 0;
8+
int size = input.nextInt();
9+
int a [] = new int [size];
10+
for (int i = 0; i < a.length; i++) {
11+
System.out.println("enter number" + (i + 1));
12+
a[i] = input.nextInt();
13+
}
14+
System.out.println("input value to search for in the array");
15+
int f = input.nextInt();
16+
for (int i : a ) {
17+
if (f == i) {
18+
found = found + 1;
19+
}
20+
}
21+
System.out.println(f + " occurs " + found + " times" );
22+
}
23+
}

barclass12.class

1.98 KB
Binary file not shown.

barclass12.ctxt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#BlueJ class context
2+
comment0.target=barclass12
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
comment2.params=p
6+
comment2.target=boolean\ check_If_Prime(int)
7+
numComments=3

barclass12.java

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import java.util.Scanner;
2+
3+
public class barclass12 {
4+
public static void main( String args[] ) {
5+
Scanner input = new Scanner(System.in);
6+
int prime = 0, primeindex = 0, index = 0;
7+
int a [] = new int [7];
8+
for (int i = 0; i < a.length; i++) {
9+
System.out.println("enter distict number " + (i + 1));
10+
a[i] = input.nextInt();
11+
if (a[i] < 2) {
12+
System.out.println("that number is less than 2");
13+
}
14+
}
15+
16+
for (int i : a) {
17+
boolean value = check_If_Prime(i);
18+
if (value == true && prime <= i) {
19+
prime = i;
20+
primeindex = index;
21+
}
22+
index = index + 1;
23+
}
24+
boolean value = check_If_Prime(prime);
25+
if (value == true) {
26+
System.out.println("largest prime number is: " + prime);
27+
System.out.println("it is in cell " + primeindex);
28+
}
29+
else {
30+
System.out.println("no prime numbers");
31+
}
32+
}
33+
34+
public static boolean check_If_Prime(int p) {
35+
int i = 2;
36+
boolean m = true;
37+
if(p == 1 || p == 0) {
38+
return false;
39+
}
40+
else {
41+
while (i <= Math.sqrt(p) && m==true) {
42+
if (p % i == 0) {
43+
m = false;
44+
}
45+
else {
46+
i++;
47+
}
48+
}
49+
if (m == true)
50+
return true;
51+
else
52+
return false;
53+
}
54+
}
55+
}
56+
57+

barclass13.class

1.87 KB
Binary file not shown.

barclass13.ctxt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#BlueJ class context
2+
comment0.target=barclass13
3+
comment1.params=args
4+
comment1.target=void\ main(java.lang.String[])
5+
numComments=2

0 commit comments

Comments
 (0)