Computer Science, asked by Anonymous, 1 year ago

accept the marks in 5 subjects and calculate the total and percentage in java


MaverickMani: Oh alright. Have a good day again.
MaverickMani: by the way that guy's answer is wrong isn't it
MaverickMani: Now I can breathe better. alright have a good day again and again
MaverickMani: Final question. I won't disturb you again. May i know the author name of your java book??

Answers

Answered by RishabhRoy2002
3
class ishika
{
void show(int a,int b, int c, int d,int e)//(a,b,c,d,e are the types of subjects)//
{
int total= (a+b+c+d+e)
double P = ((total/500)*100)
System. out.println ("The total mark is "+total);

System. out.println (" Percentage is "+ P);
}
}

...Hope it will help you....

★★★★★
// line is for you to understand....which shouldn't be written in the program....

RishabhRoy2002: yes
RishabhRoy2002: but u have to write something in the place of "main"
MaverickMani: You must be doing your Programming class again i thinks. bcoz, C, Cpp, Java wont run without main method.
MaverickMani: you are talking about normal method. that is ok.
MaverickMani: but every program should contain atleast one main method.
MaverickMani: Ok Ishika Good night.
RishabhRoy2002: i don't know...it's a normal method which is compiled........class complied- no error
MaverickMani: where is the object declaration buddy?
MaverickMani: there must be compile time error. like 'main method not found'
Similar questions