Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lab.pkg4;
- import java.util.Scanner;
- class Movie{
- String title, studio,rating;
- Movie(String title,String studio,String rating){
- this.title=title;
- this.studio=studio;
- this.rating=rating;
- }
- Movie(String title,String studio){
- this.title=title;
- this.studio=studio;
- this.rating="PG";
- }
- void dis(){
- System.out.println(title);
- System.out.println(studio);
- System.out.println(rating);
- }
- }
- public class Lab4 {
- public static void main(String[] args) {
- String a,b,c;
- Scanner x = new Scanner(System.in);
- a=x.nextLine();
- b=x.nextLine();
- c=x.nextLine();
- if(c=="PG"){
- Movie nm=new Movie(a,b);
- nm.dis();}
- else{
- Movie ns=new Movie(a,b,c);
- ns.dis();}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement