Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword or section
Like this
32Activity
0 of .
Results for:
No results containing your search query
P. 1
Java Final Submission (java programs)

Java Final Submission (java programs)

Ratings:

5.0

(1)
|Views: 4,214 |Likes:
Published by TB

More info:

Published by: TB on May 22, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

02/18/2014

pdf

text

original

 
 Java Programs List
1.Write and run a Java program that initializes astring object with your first name and then printsit on three separate lines.2.Write and run a Java program that initializes astring object with your first name and then printsit three times on the same line, separated byspaces...
Ram Ram Ram
3.Write and run a Java program that does thefollowing:Declare a string object named as s containingthe string "CALL ME ISHMAEL".Print the entire string.
Use the length() method to print the length of the string.Use the charAt() method to print the firscharacter of the string.Use the charAt() and the length() methods to print the last character of the string.Use the indexOf() and the substring() methodsto print the first word in the string
.4.Write and run a Java program that enters a 10-digit string as a typical U.S telephone number,extract the 3-digit area code, the 3-digitexchange code and the remaining 4-digits as thehouse number as a separate strings, print them,and then prints the complete telephone numberin the usual formatting.A sample run might look like this:
 
Enter a 10-digit telephone number: 1234567890You entered: 1234567890The area code is: 123The exchange code is: 456The house number is: 7890The complete telephone number is: (123)456-7890
5.Write and run a Java program that inputs apersons name in the form First Middle Last andthen prints it in the form Last, First M. where M isthe person's middle name initial. For example:
Input: William Jefferson ClintonWhich produces the output Clinton, William J.
6.Write a program that reads three stringsinteractively and then prints them in the order of their lengths.7.Write and run a Java program that reads threestrings interactively and then prints them inlexicographic (i.e. dictionary) order.8. Write a Java program that capitalizes a two wordname. For example, the string literal
noRtHCARolina
would produce the output
NorthCarolina
.9.Write and run a Java program that inputs aninteger that represents a temperature on theFahrenheit scale and then computes and printsits equivalent Celsius values. Use the conversionformula C=5(F-32)/9.
 
10.Write and run a Java program that inputs aninteger that represents a temperature on theCelsius scale and then computes and prints itsequivalent Fahrenheit value. Use the conversionformula F=1.8C+32.11. Write and run a Java program that generates arandom integer, test whether it is positive, andreport that it is if it is.12.Write and run a Java program that generates arandom number between 2 and 600 inclusive,and then uses nested if...else statements todetermine whether it is divisible by 2, 3, 5, 6, 10,15, and/or 30.13. Write and run a Java program to sort the arrayfirst, then copy elements of array into anotherusing the System.arraycopy() API.14.Write and run a Java program that initializes aninteger variable n with the value 5841 and thenuses the quotient and remainder operators toextract and print each digit of n. The digits of nare 5, 8, 1, 4.15. Define a class, Mcmlength, to represent a lengthmeasured in meters, centimeters, andmillimeters, each stored as integers.Include constructors that accepts threearguments in millimeters, one double argumentsin centimeters, and no arguments, which create

Activity (32)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Lokman Hakim liked this
Safiyah Pirmang liked this
Ankit Jain liked this
Armin Suljovic liked this
Leroy Serepe liked this
titun8723 liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->