for a friend who needs help
public class Card
{
private static final double True = 0;//sets true
public String Card;//sets card
public Card(String Card2)
{
Card = Card2;//sets card2
}
public double getDiscription()
{
if (Card.equals("AS"))//if the "AS" is put in it prints below
{
System.out.println("Ace of Spades");
}
else if (Card.equals("AC"))//if the "AC" is put in it prints below
{
System.out.println("Ace of Clubs");
}
else if (Card.equals("AD"))//if the "AD" is put in it prints below
{
System.out.println("Ace of Diamonds");
}
else if (Card.equals("AH"))//if the "AH" is put in it prints below
{
System.out.println("Ace of Hearts");
}
else if (Card.equals("KS"))//if the "KS" is put in it prints below
{
System.out.println("King of Spades");
}
else if (Card.equals("KC"))//if the "KC" is put in it prints below
{
System.out.println("King of Clubs");
}
else if (Card.equals("KD"))//if the "KD" is put in it prints below
{
System.out.println("King of Diamonds");
}
else if (Card.equals("KH"))//if the "KH" is put in it prints below
{
System.out.println("King of Hearts");
}
else if (Card.equals("QS"))//if the "QS" is put in it prints below
{
System.out.println("Queen of Spades");
}
else if (Card.equals("QC"))//if the "QC" is put in it prints below
{
System.out.println("Queen of Clubs");
}
else if (Card.equals("QD"))//if the "QD" is put in it prints below
{
System.out.println("Queen of Diamonds");
}
else if (Card.equals("QH"))//if the "QH" is put in it prints below
{
System.out.println("Queen of Hearts");
}
else if (Card.equals("JS"))//if the "JS" is put in it prints below
{
System.out.println("Jack of Spades");
}
else if (Card.equals("JC"))//if the "JC" is put in it prints below
{
System.out.println("Jack of Clubs");
}
else if (Card.equals("JD"))//if the "JD" is put in it prints below
{
System.out.println("Jack of Diamonds");
}
else if (Card.equals("JH"))//if the "JH" is put in it prints below
{
System.out.println("Jack of Hearts");
}
else if (Card.equals("10S"))//if the "10S" is put in it prints below
{
System.out.println("10 of Spades");
}
else if (Card.equals("10C"))//if the "10C" is put in it prints below
{
System.out.println("10 of Clubs");
}
else if (Card.equals("10D"))//if the "10D" is put in it prints below
{
System.out.println("10 of Diamonds");
}
else if (Card.equals("10H"))//if the "10H" is put in it prints below
{
System.out.println("10 of Hearts");
}
else if (Card.equals("9S"))//if the "9S" is put in it prints below
{
System.out.println("9 of Spades");
}
else if (Card.equals("9C"))//if the "9C" is put in it prints below
{
System.out.println("9 of Clubs");
}
else if (Card.equals("9D"))//if the "9D" is put in it prints below
{
System.out.println("9 of Diamonds");
}
else if (Card.equals("9H"))//if the "9H" is put in it prints below
{
System.out.println("9 of Hearts");
}
else if (Card.equals("8S"))//if the "8S" is put in it prints below
{
System.out.println("8 of Spades");
}
else if (Card.equals("8C"))//if the "8C" is put in it prints below
{
System.out.println("8 of Clubs");
}
else if (Card.equals("8D"))//if the "8D" is put in it prints below
{
System.out.println("8 of Diamonds");
}
else if (Card.equals("8H"))//if the "8H" is put in it prints below
{
System.out.println("8 of Hearts");
}
else if (Card.equals("7S"))//if the "7S" is put in it prints below
{
System.out.println("7 of Spades");
}
else if (Card.equals("7C"))//if the "7C" is put in it prints below
{
System.out.println("7 of Clubs");
}
else if (Card.equals("7D"))//if the "7D" is put in it prints below
{
System.out.println("7 of Diamonds");
}
else if (Card.equals("7H"))//if the "7H" is put in it prints below
{
System.out.println("7 of Hearts");
}
else if (Card.equals("6S"))//if the "6S" is put in it prints below
{
System.out.println("6 of Spades");
}
else if (Card.equals("6C"))//if the "6C" is put in it prints below
{
System.out.println("6 of Clubs");
}
else if (Card.equals("6D"))//if the "6D" is put in it prints below
{
System.out.println("6 of Diamonds");
}
else if (Card.equals("6H"))//if the "6H" is put in it prints below
{
System.out.println("6 of Hearts");
}
else if (Card.equals("5S"))//if the "5S" is put in it prints below
{
System.out.println("5 of Spades");
}
else if (Card.equals("5C"))//if the "5C" is put in it prints below
{
System.out.println("5 of Clubs");
}
else if (Card.equals("5D"))//if the "5D" is put in it prints below
{
System.out.println("5 of Diamonds");
}
else if (Card.equals("5H"))//if the "5H" is put in it prints below
{
System.out.println("5 of Hearts");
}
else if (Card.equals("4S"))//if the "4S" is put in it prints below
{
System.out.println("4 of Spades");
}
else if (Card.equals("4C"))//if the "4C" is put in it prints below
{
System.out.println("4 of Clubs");
}
else if (Card.equals("4D"))
{//if the "4D" is put in it prints below
System.out.println("4 of Diamonds");
}
else if (Card.equals("4H"))//if the "4H" is put in it prints below
{
System.out.println("4 of Hearts");
}
else if (Card.equals("3S"))//if the "3S" is put in it prints below
{
System.out.println("3 of Spades");
}
else if (Card.equals("3C"))//if the "3C" is put in it prints below
{
System.out.println("3 of Clubs");
}
else if (Card.equals("3D"))//if the "3D" is put in it prints below
{
System.out.println("3 of Diamonds");
}
else if (Card.equals("3H"))//if the "3H" is put in it prints below
{
System.out.println("3 of Hearts");
}
else if (Card.equals("2S"))//if the "2S" is put in it prints below
{
System.out.println("2 of Spades");
}
else if (Card.equals("2C"))//if the "2C" is put in it prints below
{
System.out.println("2 of Clubs");
}
else if (Card.equals("2D"))//if the "2D" is put in it prints below
{
System.out.println("2 of Diamonds");
}
else if (Card.equals("2H"))//if the "2H" is put in it prints below
{
System.out.println("2 of Hearts");
}
return True;
}
}
import java.util.Scanner;
public class CardTester
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);//creates new scanner
System.out.println("Enter Your Card");
String card = keyboard.nextLine();
card = card.toUpperCase();//makes even a lowercase a work
Card set1 = new Card(card);//creates new card
System.out.println(set1.getDiscription());//prints discription
}
}
public class Grade
{
public String letterGrade;// creates lettergrade
public Grade(String initGrade)//sets grade
{
letterGrade = initGrade;//sets lettergrade
}
public double getNumericGrade()
{
double grade = 0; //sets grades value
if (letterGrade.equals("A+"))// if "A+" is inputed returns
{
return (4.0);
}
else if (letterGrade.equals("A"))//if a is inputed returns
{
return (3.9);
}
else if (letterGrade.equals("A-"))//if a- is inputed returns
{
return (3.6);
}
else if (letterGrade.equals("B+"))//if b+ is inputed returns
{
return (3.3);
}
else if (letterGrade.equals("B"))//if b is inputed returns
{
return (3);
}
else if (letterGrade.equals("B-"))//if b- is inputed returns
{
return (2.7);
}
else if (letterGrade.equals("C+"))//if c+ is inputed returns
{
return (2.4);
}
else if (letterGrade.equals("C"))// if c is inputed returns
{
return (2.1);
}
else if (letterGrade.equals("C-"))//if c- is inputed returns
{
return (1.9);
}
else if (letterGrade.equals("D+"))//if d+ is inputed returns
{
return (1.6);
}
else if (letterGrade.equals("D"))//if d is inputed returns
{
return (1.3);
}
else if (letterGrade.equals("D-"))//if d- is inputed returns
{
return (1);
}
else if (letterGrade.equals("F"))//if f is inputed returns
{
return (.7-0);
}
return grade;//returns grade
}
}
import java.util.Scanner;
public class GradeTester
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter Your Letter Grade");//creates new scanner
String x = keyboard.nextLine();//sets x
x = x.toUpperCase();
Grade g = new Grade(x);//creates a new grade
double grade = g.getNumericGrade();// sets grade to getNumericalGrade
System.out.println("Numeric value: " + grade);//Prints
}
}
public class Floating
{
private double x;//creates x
private double y;//creates y
private double z;//creates z
public Floating(double x2, double y2,double z2)
{
x = x2;//sets x
y = y2;//sets y
z = z2; //sets z
}
public boolean getorder()
{
if(x <= y && y <= z)//if the statement is true prints below.
{
System.out.println(x);
System.out.println(y);
System.out.println(z);
}
else if (x <= z && z <= y)//if the statement is true prints below.
{
System.out.println(x);
System.out.println(z);
System.out.println(y);
}
else if(z <= x && x <= y)//if the statement is true prints below.
{
System.out.println(z);
System.out.println(x);
System.out.println(y);
}
else if(z <= y && y <= x)//if the statement is true prints below.
{
System.out.println(z);
System.out.println(y);
System.out.println(x);
}
else if(y <= z && z <= x)//if the statement is true prints below.
{
System.out.println(y);
System.out.println(z);
System.out.println(x);
}
else if(y <= x && x <= z)//if the statement is true prints below.
{
System.out.println(y);
System.out.println(x);
System.out.println(z);
}
else
System.out.println("SYSTEM ERROR PLEASE RETRY");//if a letter is entered will print this
return true;
}
}
import java.util.Scanner;
public class FloatingTester
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);//makes new scanner
System.out.println("Enter Your First Number");
double x = keyboard.nextDouble();//sets x
System.out.println("Enter Your Second Number");
double y = keyboard.nextDouble();//sets y
System.out.println("Enter Your Third Number");
double z = keyboard.nextDouble();//sets z
Floating set1 = new Floating(x,y,z);//creates a new floating
System.out.println(set1.getorder());//prints
}
}