Question: Follow the steps below to complete the Lab 1 1 . 1 . Create the project for Lab 1 1 2 . Add package CSCI
Follow the steps below to complete the Lab
Create the project for Lab
Add package CSCIL
Add class Lab
Add the main method:
public static mainString args
Implement the followings within the main method:
a Find the sum of the series: using an array
declare an array for the given series
int series;
int sum ;
forint i; i series.length; i
sum sum seriesi;
System.out.printfThe sum of the series: : d
sum;
b Find the sum of the series: without using an array
int sum ;
forint i; i ; i i i i
sum sum i;
System.out.printfThe sum of the series: : d
sum;
c Find the sum of the series: without using an array
int sum ;
forint i; i ; i i i i
sum sum i;
System.out.printfThe sum of the series: : d
sum;
d Find & print the sum of the series: without using an array
e Find & print the sum of the series: without using an array
Add a static method called:
public static void myStringOperations
Implement the followings in the myStringOperations method:
a Declare a String type variable called str and initialize with
"CSCILProgramming I in Java"
b Find and print the length of the String variable str:
strlength;
c Find and print the index of the character P:
int index strindexOfP;
d Find and print the index of
e Find and print the index of the white space character
f Find and print the substring at the index found in e
String str fullname.substringindex;
Add the following method call in the main method:
myStringOperations;
Run the program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
