?

Log in

dzhugashvili [entries|archive|friends|userinfo]
dzhugashvili

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

(no subject) [Nov. 8th, 2005|08:30 pm]
dzhugashvili
import apcslib.*;
import chn.util.*;

public class Testing
{


public static void main(String args[]) {

ConsoleIO x = new ConsoleIO();
String grade;
int divisor = 0;
double GPA;
int grades;
int F = 0;
System.out.print("Grade for one class? (type done when finished) -> ");
for (int i = 1; i <= 1000; i++;)
{


String grade = x.readToken();

if (grade.equalsIgnoreCase("a")
{
grades += 4;
divisor += 1;
}
else if (grade.equalsIgnoreCase("b")
{
grades += 3;
divisor += 1;
}
else if (grade.equalsIgnoreCase("c")
{
grades +=2;
divisor += 1;
}
else if (grade.equalsIgnoreCase("d")
{
grades += 1;
divisor += 1;
}
else if (grade.equalsIgnoreCase("f")
{
grades += 0;
divisor += 1;
F += 1;
}
else i += 1000;
}
GPA = grades / divisor;
System.out.print("\nGPA = " + Format.left(GPA,0,2));

if (GPA >= 2.0 && F == 0 && divisor >= 4)
{
eligibility++;
}
else if(GPA >= 2.0 && F == 0 && divisor < 4)
{
eligibility += 2;
}
else if(GPA < 2.0 && F == 0 && divisor >= 4)
{
eligibility += 3;
}
else if(GPA >= 2.0 && F > 0 && divisor >= 4)
{
eligibility += 4;
}
else if(GPA < 2.0 && F > 0 && divisor >= 4)
{
eligibility += 5;
}
else if (GPA < 2.0 && F == 0 && divisor < 4)
{
eligibility += 6;
}
switch(eligibility)
{
case 1:
System.out.print("\tEligible");
break;

case 2:
System.out.print("\tIneligible, is taking less than 4 classes");
break;

case 3:
System.out.print("\tIneligible, GPA below 2.0");
break;

case 4:
System.out.print("\tIneligible, GPA above 2.0 but has F grade");
break;

case 5:
System.out.print("\tIneligible, GPA below 2.0 and has an F grade");
break;

case 6:
System.out.print("\tIneligible, GPA below 2.0 and taking less than 4 classes");
break;
}
System.out.println();
}
}
link5 comments|post comment

(no subject) [Nov. 2nd, 2005|08:23 pm]
dzhugashvili
public void printTable(int rows, int columns)
{
int col = 1;
int row = 1;
for (int k=1; k<=row; k++)
{
System.out.println("\n" + k);
for(int z=1; z<=col; z++)
{
for (int m = 1; m <= col; m++)
{
System.out.print(" " + m + " ");
System.out.println();
}
System.out.print(z*k);

}
System.out.println();
}
linkpost comment

10.1 [Nov. 1st, 2005|08:42 pm]
dzhugashvili
import chn.util.*;

public class Lab1001 {

public static void main(String args[]) {

int rows, columns, n;
Pictures pic = new Pictures();
ConsoleIO keyboard = new ConsoleIO();
String get;

pic.printTable(4,6);
get = keyboard.readLine(); // freezes the output screen to see the picture
pic.printTable(11,12);
get = keyboard.readLine();
pic.pyramid(10);
get = keyboard.readLine();
pic.pyramid(25);
get = keyboard.readLine();

}
}

class Pictures
{
private int rows, columns, n;

public Pictures()
{
int rows;
int columns;
int n;
}

public void printTable(int rows, int columns)
{
int col = 1;
int r = 1;
int colans, rans;
do
{
do
{
System.out.print(" " + col + " ");
colans = col;
colans *= r;
System.out.print(colans + " ");
col++;
}
while (col <= columns);

System.out.println();
do
{
System.out.println(r);
rans = r;
rans *= col;
System.out.print(rans);
r++;
}
while (r <= rows);

}
}

public void pyramid(int n)
{
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= (1 + (n - 1) * 2); j++)
System.out.print(" ");
for (int m = 1; (m <= (n * 2 - 1)); m++)
System.out.print("*");
System.out.println();


}


}
}
linkpost comment

Lab 10.3 [Oct. 30th, 2005|05:47 pm]
dzhugashvili
import apcslib.*;

public class Lab1003
{
public static void main(String args[])
{
DrawingTool pencil;
SketchPad paper;
paper = new SketchPad(500,500);
pencil = new DrawingTool(paper);
pencil.up();
pencil.move(-200, 200);
for (int row = 0; row < 8; row++)
{


pencil.down();
pencil.setDirection(0);
pencil.move(50);
pencil.up();
pencil.move(50);
pencil.move(-200, 200 - (50 * row));
}
// calculate the start of the row of squares

// calculate and add a horizontal offset
pencil.up();
pencil.move(-200, 200);
for (int col = 0; col < 7; col++)
{

pencil.down();
pencil.setDirection(0);
pencil.fillRect(50, 50);
pencil.up();
pencil.move(80);
pencil.move(-180, 180 - (50 * col));
// draw the square
// calculate and position for the next square
}

// calculate the location and draw the line
}
}
linkpost comment

WHERE'S THE ERROR [Oct. 25th, 2005|09:34 pm]
dzhugashvili
import apcslib.*;
import chn.util.*;



public class Lab081
{
public static void main(String args[])
{
//initializes string and primitive type values
double fTax;
double taxIncome;
String single = "single";
String married = "married";
ConsoleIO x = new ConsoleIO();
System.out.print("Enter filing status (single or married) -> ");
String status = x.readToken();
System.out.print("Enter taxable income -> ");
taxIncome = x.readDouble();
//if statements

if (status.equalsIgnoreCase("single"))
{
if ((0 <= taxIncome) && (taxIncome <= 27050))
{fTax = taxIncome * 0.15;
System.out.println("Single\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}
else if ((27050 < taxIncome) && (taxIncome <= 65550))

{fTax = (taxIncome - 27050) * 0.275 + 4057.5;
System.out.println("Single\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}

else if ((65550 < taxIncome) && (taxIncome <= 136750))

{fTax = (taxIncome - 65550) * 0.305 + 14645;
System.out.println("Single\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}

else if ((136750 < taxIncome) && (taxIncome <= 297350))

{fTax = (taxIncome - 136750) * 0.355 + 36361;
System.out.println("Single\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}

else if (297350 < taxIncome)

{fTax = (taxIncome - 297350) * 0.391 + 93374;
System.out.println("Single\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);}

else if (taxIncome < 0)
System.out.println("Invalid taxable income");


}





if (status.equalsIgnoreCase("married"))

{if ((0 <= taxIncome) && (taxIncome <= 45200))

{fTax = taxIncome * 0.15;
System.out.println("Married\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}

else
if ((45200 < taxIncome) && (taxIncome <= 109250))
{ fTax = (taxIncome - 45200) * 0.275 + 67800;
System.out.println("Married\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}

else
if ((109250 < taxIncome) && (taxIncome <= 166500))
{fTax = (taxIncome - 109250) * 0.305 + 24393.75;
System.out.println("Married\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}

else
if ((166500 < taxIncome) && (taxIncome <= 297350))
{fTax = (taxIncome - 166500) * 0.355 + 41855;
System.out.println("Married\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}

else
if (297350 < taxIncome)
{fTax = (taxIncome - 297350) * 0.391 + 88306;
System.out.println("Married\nTaxable Income = $" + taxIncome + "\nFederal Tax = $" + fTax);
}
}}}
linkpost comment

navigation
[ viewing | most recent entries ]