1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Novosadov [1.4K]
4 years ago
11

We have to calculate the percentage of marks obtained in three subjects (each out of 100) by student A and in four subjects (eac

h out of 100) by student B. Create an abstract class 'Marks' with an abstract method 'getPercentage'. It is inherited by two other classes 'A' and 'B' each having a method with the same name which returns the percentage of the students. The constructor of student A takes the marks in three subjects as its parameters and the marks in four subjects as its parameters for student B. Create an object for eac of the two classes and print the percentage of marks for both the students.
Computers and Technology
1 answer:
MAXImum [283]4 years ago
6 0

Answer:

abstract class Mark  //Creating an Abstract class{

abstract double getPercentage();}

class A extends Mark{

double result;

A( int val1, int val2, int val3){

 result=(val1+val2+val3)/3;}

double getPercentage(){

 return result;}}

class B extends Mark{

double result;

B(int val1, int val2, int val3, int val4){

 result=(val1+val2+val3+val4)/4;}

double getPercentage(){

 return result;}}

class Main{

public static void main(String args[]){

 //class A Object

 Mark obj_1=new A(10,20,30);

 System.out.println(obj_1.getPercentage());

 //class B Object

 Mark obj_2=new B(10,20,38,46);

 System.out.println(obj_2.getPercentage());}}

You might be interested in
The first graphical browser application for using the web was netscape. <br> a. True <br> b. False
Mamont248 [21]
Hello <span>Jcece6710 
</span>

Question: <span>The first graphical browser application for using the web was netscape. True or False


Answer: True

Hope that helps
-Chris</span>
5 0
3 years ago
What is the lucky 3 digit today
victus00 [196]
That is an interactive question.
4 0
4 years ago
I need help pls, in this code if add row for example :
tankabanditka [31]
I thing is going project experiment everyone make plans and
3 0
4 years ago
WILL GIVE BRAINLIEST TO HELPFUL ANSWERS!
sashaice [31]

Algorithm is part of computer science. You an learn it on Khan academy. (you probably werent looking for this but no one was answering)

7 0
3 years ago
Can someone taught me? How to use this brainy apps la?​
Anna11 [10]
Okeh, So it basically helps you find answers for you homework and stuff and you can also answer people questions too and get points. You can get brainliest answer too. You can answer fake questions too but then you can be reported and the will delete your account
6 0
3 years ago
Other questions:
  • Heatsinks used to protect cpus in computers from overheating, are shaped so that their surface area is very large. why is that?
    5·1 answer
  • It's inventiveness uncertainty and futuristic ideas typically deals with science and technology ......what is it.
    8·1 answer
  • In which format is information stored on a hard drive?
    5·1 answer
  • To secure the company website, the webmaster suggests that the company purchase a secure certificate to encrypt all communicatio
    5·1 answer
  • the default name for the small icon that represents a web site or page, and is displayed in the browsers, typically at the begin
    9·1 answer
  • The function below takes two arguments, a dictionary called dog_dictionary and a list of dog names (strings) adopted_dog_names.
    8·1 answer
  • What are the process of boots up a computer?​
    15·2 answers
  • How do I create a simple percentage function to gather a score for a quiz in PHP?
    14·1 answer
  • In which program structure does the processor verify the mentioned condition only after executing the dependent statements once?
    8·2 answers
  • What is the difference between referential and entity integrity
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!