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
(tco 2) c++ comments are represented by which characters?
Margarita [4]
(TCO 2) In C++ terminology, (Points : 4) a ... a class object is the same as a class instance. a class object is the same as a class member. a class object is the same as a class access specifier.
4 0
3 years ago
Complete the following sentences using the drop-down menus.
shepuryov [24]

Answer:

✔ E-mail

is considered by some to be the most important program because of its popularity and wide use.

✔ Presentation

applications are used to display slide show-style presentations.

✔ Spreadsheet

programs have revolutionized the accounting industry.

Explanation:

just did it on edg this is all correct trust

7 0
3 years ago
In your own words, describe how a network administrator can use the OSI model to isolate a network problem.
fenix001 [56]

Answer:

 Network administrator use the open system interconnection model to isolate the network problem as, the network administrator can easily find the problem in the system.

Network administrator regularly depicts issues by the layer number and in many cases the network problem required the network administrator to isolate the issue in which layer the maximum number of issue occurred.

By using the OSI layer, we can easily add protocols to its higher to lower layers without any type of interruption.

3 0
3 years ago
Modify the countUp( ) you wrote in the previous question to countUp( num), where num is a parameter. The function displays from
algol [13]

Answer:

void countUp(int num)

{

   if(num==0) //base case.

   return;

   countUp(num-1);//Recursive call.

   cout<<num<<" "; //printing the number.

}

for input num=25

Output:-1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Explanation:

I have used recursion to print the numbers the function is in c++ language.In every recursive call we are decreasing num by 1.As the base case is reached.Then it will backtrack from 1 to num and then we are printing while backtracking.

4 0
4 years ago
_______________________ variables do not need to be declared inside the function definition body, they get declared when the fun
stealth61 [152]

<u>Formal paramete</u>r variables doesn't have to be declared inside the function definition body because they are declared when the function is called.

<h3>What is a formal parameter?</h3>

A formal parameter can be defined as a type of variable which a programmer specifies when he or she needs to determine the subroutine or function.

This ultimately implies that, <u>formal paramete</u>r variables doesn't have to be declared inside the function definition body because they are declared when the function is called.

Read more on function parameter here: brainly.com/question/20264183

#SPJ11

8 0
2 years ago
Other questions:
  • An authenticated user can add up to how many computer accounts to the domain, by default
    6·1 answer
  • You can choose to use a window manager only, and not use a desktop manager.
    8·2 answers
  • What event in the 1970s contributed to the current
    6·2 answers
  • ammy's Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. Write a program
    13·1 answer
  • The refresh or reload button is in the browser toolbar and usually looks like a pair of curved arrows. Clicking it will ________
    14·2 answers
  • What will you do to run a presentation from a computer on which you did not prepare the presentation, and how?
    13·1 answer
  • You can remove selected text from a slide by pressing ctrl+x keyboard shortcut keys true or false
    7·1 answer
  • Impact of computer in society, using relevant examples​
    13·1 answer
  • 5
    15·1 answer
  • List safety conditions when downloading shareware, free free where, or public domain software
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!