Document
Document
import java.util.*;
class movieMagic
int year; String title; float rating; //these are data members or variables of class
title = sc.nextLine();
year = sc.nextInt();
rating= sc.nextFloat();
System.out.println(" Flop");
System.out.println("Semi-hit");
System.out.println(" Hit");
else // this is the condition if ( rating >= 4.6 && rating <= 5.0 )
System.out.println("Super Hit");
movieMagic obj = new movieMagic() ; // creating or making object 'obj' of the class movie Magic
obj.display();// calling function of the class to decide the status and print data
2)
import java.io.*;
class overloadArea
double s = (a+b+c)/2;
return Area;
double area( int a, int b, int height ) // this is 2nd overloaded function
return( (double)(height * (a + b) ) /2 ); //see that the return type is 'double' so type casting is must
double area( double diagonal1, double diagonal2 ) // this is 3rd overloaded function
double Area= ( diagonal1*diagonal2) / 2; //you may also write: return (( diagonal 1 * diagonal 2) / 2 );
return Area;
// The main() function starts below. You may OMIT this because as per the question the main() is NOT
needed
}//end of class