corsasport.co.uk
 

Corsa Sport » Message Board » General Chat » java experts!!


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author java experts!!
Jason
Member

Registered: 5th Aug 03
Location: Northern Ireland
User status: Offline
13th Nov 03 at 00:59   View User's Profile U2U Member Reply With Quote

jus done this.. the neipack bit prob wont work and may not compile etc but cud ya's run ur eyes over this and see if anythings wrong while i start commenting! cheers


import neiPack.*;
public class MyAttempt
{

public static void main (String[] args)
{
// Part A creating strings.

// A number of strings declared with different values

String firstName="Wolfgang";
String middleName="Amadeus";
String surname="Mozart";

String fullName=new String ();
String firstName2 = "Wolfgang";
String surName2 = "Mozart";

{
fullname = firstName.concat(" "+middleName+" "+surname);

neInOut.println ("The Muscisians full name is "+fullName);

}

int fullNameLength = fullName.length();

{
neInOut.println("The length of the string= "+fullNameLength+" Characters");
}
neInOut.println("The Musicians firstname is "+firstName2);
neInOut.println("The Musicians firstname is "+surname2);

String fullNameUC=fullName.toUpperCase() ;

{
neInOut.println("The name printed in capitals is "+fullnameUC);
}

//Part B assigning integers with values and calculations.
//Integer values declared and assigning them with numeric values.

int a=10;
int b=50;
int c=10;

neInOut.println("Enter an integer value");

int d=neInOut.readInt ();

neInOut.println("Enter an integer value");
int e=neInOut.readInt();

int f=(b*c);

{
integer values
neInOut.println(b+" Multiplied by "+c+" = "+f);
}

int g=(a*c);

{
neInOut.println(a+" Multiply by "+c+" ="+g);
}

int h=(f-g);

{
neInOut.println("The difference between "+f+" and "+g+" = "+h");
}

int i =(f+g);

{
neInOut.println("The sum of "+f+" and "+g+ = "+i);
{

int j=(d*e);

{
neInOut.println("d+"Multiplied by "+e+" = "+j);
{

int k=(g*j);

{
neInOut.println(g+"Multiplied by "+j+" = "+k);
}

int l=(j-k);

{
neInOut.println("The difference between "+j+" and "+k+" = "+l);
}

int m=(f/g);

{
neInOut.println(f+" divided by +g+" = "m);
}


for(int count=0;count<5;count++)

neInOut.println("User has typed in "+d+" and "+e+", which were stored in two variables.");

}
}
Jason
Member

Registered: 5th Aug 03
Location: Northern Ireland
User status: Offline
13th Nov 03 at 01:00   View User's Profile U2U Member Reply With Quote

hmm indentation didnt come out 100%!
John_C
Member

Registered: 5th Mar 03
Location: South east, Bromley
User status: Offline
13th Nov 03 at 15:19   View User's Profile U2U Member Reply With Quote

y not read a java book. thats wot the rest of us do

 
New Topic

New Poll

Corsa Sport » Message Board » General Chat » java experts!! 23 database queries in 0.0058830 seconds