Java Second Exam in Jspider
Java Second Exam in Jspider
1. Write java program to define object for Car with below attributes
1. Brand name
2. Engine type
3. Fuel type
4. Seating capacity
5. Model
Student name
Degree
Phone
4. Write a java program to print the character is alpha ,numeric or special char.
String brandname;
String enginetype;
String fueltype;
String seating_capacity;
String model;
this.brandname=brandname;
this.enginetype=enginetype;
this.fueltype=fueltype;
this.seating_capacity=seating_capacity;
this.model=model;
}
void details() {
System.out.println("brandname is:"+brandname+"enginetype
is:"+enginetype+"fuletype is:"+fueltype+"seating_capacity
is:"+seating_capacity);
}
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
System.out.println("brandname is:");
String ebrandname=sc.next();
System.out.println("enginetype is:");
String eenginetype=sc.next();
System.out.println("fueltype is:");
String efueltype=sc.next();
System.out.println("seating_capacity of:");
String eseating_capacity=sc.next();
System.out.println("model is:");
String emodel=sc.next();
Car c1=new
Car(ebrandname,eenginetype,efueltype,eseating_capacity,emodel);
c1.details();
}}
(===============================================================)
class Customerdetails {
String fullname;
char gender;
long mobile_no;
String email_id;
String location;
void display()
{
System.out.println("fullname: "+fullname+", gender: "+gender+",
mobile_no: "+mobile_no+", email_id: "+email_id+" , location: "+location);
}
(===============================================================)
class Information {
String studentname;
String degree;
String email;
long phoneno;
Information i1=new
Information(estudentname,edegree,eemail);
i1.details();
}
else if(c=='p') {
System.out.println("student name is:");
String estudentname=sc.next();
System.out.println("degree ehich have is:");
String edegree=sc.next();
System.out.println("phonr number is:");
long ephoneno=sc.nextLong();
Information i2=new
Information(estudentname,edegree,ephoneno);
i2.details();
}
else {
System.out.println("invalid input");
}
}
}
(===============================================================)
import java.util.Scanner;
public class Character {
}
}
(===============================================================)
import java.util.Scanner;
public class Leapyear {
}
}
(===============================================================)