0% found this document useful (0 votes)
31 views3 pages

Java Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Java Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Complete the Solution so that the function will break up camel casing, using
space between words.
Eg:
“camelCasing” => “camel Casing”

PROGRAM :

public class BreakWords{


public static void main(String args[]){
String input = "casingCamel";
StringBuilder result = new StringBuilder();
for(char c: [Link]()){
if([Link](c)){
[Link](" ");
}
[Link](c);
}
[Link]([Link]());
}

OUTPUT :
2. Write a program which creates a class Student with the following Data Members rollNum, studName,
mark1,mark2,mark3 and total marks.

Methods setStudDetails()which sets the values to all the data members except totalMarks. calculatTotal()-
which calculate the total Marks and display the total mark. Creata a class StudentDemo to access the class
Student

PROGRAM :

class Student{
int rollNum,mark1,mark2,mark3,totalMarks;
String stuName;
void setStudDetails(int r,int m1,int m2,int m3,String name){
rollNum = r;
mark1 = m1;
mark2 = m2;
mark3 = m3;
stuName = name;
}
void calculateTotal(){
totalMarks = mark1+mark2+mark3;
}
void displayStuddetails(){
[Link]("Name: "+stuName);
[Link]("Roll number: "+rollNum);
[Link]("Total marks in 3 subjects: "+totalMarks);
}

}
class Team_6{
public static void main(String args[]){
Student obj = new Student();
[Link](22011,100,100,100,"Japson");
[Link]();
[Link]();
}

}
OUTPUT:

You might also like