7o Ergastirio
Clothing Store
import java.io.*;
class clothingstore {
public static void main (String args[]) throws IOException {
InputStreamReader inSystem = new InputStreamReader (System.in);
BufferedReader stdin = new BufferedReader (inSystem);
String inData;
int katigoria;
System.out.print ("to katastima mas sas prosferi kapies ekptosis");
System.out.println ("analoga me tin katigoria stin opoia aniki to rouxo pou epilexate");
System.out.println ("mporite na epilexete 1 gia thn katigoria A");
System.out.println (" 2 gia thn katigoria B");
System.out.println (" 3 gia thn katigoria C");
System.out.println (" 4 gia otigipote allo");
System.out.println("doste tin kathgoria tou pouxou gia na enhmerothite gia tin diathesimi ekptosi");
inData = stdin.readLine();
katigoria = Integer.parseInt(inData);
if (katigoria== 1)
System.out.println("den exete kapoia ekptosi.");
if else (katigoria== 2)
System.out.println("exete 10% ekptosi.");
if else (katigoria== 3)
System.out.println("exete 20% ekptosi.");
else
System.out.println("exete 30% ekptosi.");
}
}
Discount
class ClothingStore
{
public static void main(String Args[])throws IOException
{
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String inData;
int choice;
int choice_accepted;
double price;
choice=6;
while(choice!=5)
{
choice_accepted=0;
while(choice_accepted==0)
{
System.out.println("Press 1 for A class goods.");
System.out.println("Press 2 for B class goods.");
System.out.println("Press 3 for C class goods.");
System.out.println("Press 4 for any other type of good.");
System.out.println("Press 5 to quit the program.");
inData=stdin.readLine();
choice=Integer.parseInt(inData);
if (choice>=1&&choice<=5)
choice_accepted=1;
else
System.out.println("Please chose between 1 and 5!");
}
if (choice!=5)
{
System.out.println("Now type the real price of the good");
inData=stdin.readLine();
price=Double.parseDouble(inData);
System.out.println("The discounted price is:");
if (choice==1)
System.out.println(price);
if (choice==2)
System.out.println(0.9*price);
if (choice==3)
System.out.println(0.8*price);
if (choice==4)
System.out.println(0.7*price);
}
}
}
}
Minimum
{
public static void main(String Args[])
{
int a = 7, b=21;
System.out.println("The min is: "+(a<b ?a:b));
}
}
Metritis Xaraktirwn(String Tester)
class stringTester{
public static void main ( String args[] ) {
String str1;
int len;
str1 = new String("Random Jottings");
len = str1.length();
System.out.println("the string" + str1 + "is" + len + " characters long");
}
}