Commit 9cac4de9 authored by Jonathon Adlington's avatar Jonathon Adlington

test

parent 1975d73d
File added
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Ass wk work Prog</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Acsending_Order</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
import java.util.Scanner;
public class three {
public static void main(String[] args) {
// TODO Auto-generated method stub
int fn, sn, tn;
System.out.println("Enter three numbers");
Scanner in = new Scanner(System.in);
fn = in.nextInt();
sn = in.nextInt();
tn = in.nextInt();
if(fn < sn)
{
if(fn < sn && sn < tn)
{
System.out.println(fn + " " + sn + " " + tn);
}
else
{
System.out.println(fn + " " + tn + " " + sn);
}
}
else if(sn < fn)
{
if(sn < fn && fn < tn)
{
System.out.println(sn + " " + fn + " " + tn);
}
else
{
System.out.println(sn + " " + tn + " " + fn);
}
}
else if(tn < fn)
{
if(tn < fn && fn < sn)
{
System.out.println(tn + " " + fn + " " + sn);
}
else
{
System.out.println(tn + " " + sn + " " + fn);
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Fibonacci_Sequence</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
import java.util.Scanner;
public class sequence {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n1=0,n2=1,n3,i,count;
System.out.println("Enter positive number");
Scanner in = new Scanner(System.in);
count = in.nextInt();
System.out.print(n1+" "+n2);//printing 0 and 1
for(i=2;i<count;++i)//loop starts from 2 because 0 and 1 are already printed
{
n3=n1+n2;
System.out.print(" "+n3);
n1=n2;
n2=n3;
}
}
}
File added
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
import java.util.Scanner;
public class leap {
public static void main(String[] args) {
// TODO Auto-generated method stub
int year;
System.out.println("Please enter year...");
Scanner in = new Scanner(System.in);
year = in.nextInt();
if(year % 400 == 0)
{
System.out.println(year + " is a leap year");
}
else if(year % 4 == 0 ^ year % 100 == 0)
{
System.out.println(year + " is a leap year");
}
else
{
System.out.println(year + " is NOT a leap year");
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Odds_and_Evens</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
import java.util.Scanner; //This import statement allows me to call the class Scanner, which is declared elsewhere.
public class oddeven{
public static void main(String[] args) {
// TODO Auto-generated method stub
int x; // Here the variable x is declared as an integer.
System.out.println("Please enter a number"); //When the program run, this will display the message written in blue.
Scanner in = new Scanner(System.in); // Scanner is a class in java.util, which allows the user to input required data
x = in.nextInt(); // This initialises the variable x,
if (x % 2 == 0) //This is an if statement, if x returns a remainder of 0 after being divided by 2, the following line of code will be executed.
System.out.println(x + " is Even"); // this line of code will be executed if the remainder equals 0. This line of will display what x is and also the message " is Even"
else // else
System.out.println(x + " is Odd");// the statement will be executed if the remainder doesn't equal 0
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Postage_Cost</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
import java.util.Scanner;
public class cost {
public static void main(String[] args) {
// TODO Auto-generated method stub
float weight;
System.out.println("Please enter weight(kg)...");
Scanner in = new Scanner(System.in);
weight = in.nextFloat();
if(weight < 1)
{
System.out.printf(weight + "kg" + " = £" + "%.2f", weight * 1.5);
}
else if(weight < 2)
{
System.out.printf(weight + "kg" + " = £" + "%.2f", weight * 3);
}
else if(weight < 3)
{
System.out.printf(weight + "kg" + " = £" + "%.2f", weight * 4);
}
else if(weight > 3)
{
System.out.printf(weight + "kg" + " = £" + "%.2f", weight * 5);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Pyramid_Pattern</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
public class pyramid {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i=0,j=0,n=5,k=0;
for(i=0; i<n; i++)
{
k=1;
for(j=0; j<(n+i); j++)
{
if(j<n-i-1)
System.out.print(" ");
else
{
System.out.print(""+k);
if(j<(n-1))
k++;
else
k--;
}
}
System.out.println(" ");
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment