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]
3 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]3 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
In MS Word we can merga cells true or false​
sergey [27]
In this video I showed you all of the locations for all items in Wacky Wizards!! I hope you enjoyed and please like and subscribe. Piece out!!!
7 0
2 years ago
Read 2 more answers
5)What are the differences in the function calls between the four member functions of the Shape class below?void Shape::member(S
Stells [14]

Answer:

void Shape :: member ( Shape s1, Shape s2 ) ; // pass by value

void Shape :: member ( Shape *s1, Shape *s2 ) ; // pass by pointer

void Shape :: member ( Shape& s1, Shape& s2 ) const ; // pass by reference

void Shape :: member ( const Shape& s1, const Shape& s2 ) ; // pass by const reference

void Shape :: member ( const Shape& s1, const Shape& s2 ) const ; // plus the function is const

Explanation:

void Shape :: member ( Shape s1, Shape s2 ) ; // pass by value

The s1 and s2 objects are passed by value as there is no * or & sign with them. If any change is made to s1 or s2 object, there will not be any change to the original object.

void Shape :: member ( Shape *s1, Shape *s2 ) ; // pass by pointer

The s1 and s2 objects are passed by pointer as there is a * sign and not & sign with them. If any change is made to s1 or s2 object, there will be a change to the original object.

void Shape :: member ( Shape& s1, Shape& s2 ) const ; // pass by reference

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. If any change is made to s1 or s2 object.

void Shape :: member ( const Shape& s1, const Shape& s2 ) ; // pass by const reference

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. The major change is the usage of const keyword here. Const keyword restricts us so we cannot make any change to s1 or s2 object.

void Shape :: member ( const Shape& s1, const Shape& s2 ) const ; // plus the function is const

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. const keyword restricts us so we cannot make any change to s1 or s2 object as well as the Shape function itself.

5 0
3 years ago
Give the name and the syntax of the HTML Tag which is <br><br>used for creating a Hypertext Link.​
Annette [7]

Answer:

<a href="enter_site_url_here">Click here to visit site!</a>

Explanation:

href is the link that the element is going to point towards. Meaning it's going to direct the end-user to that site. "Click here to visit site!" is the text that the element is going to say, and that text will have an underline. So it's best to keep it short as you don't want <u>something like this happening on your site</u>.

I'd stick with the classic "here" as the text and have the text before-hand say "Click" and after-hand say " to visit site X" with X being the site name. Or, something along those lines.

8 0
2 years ago
Which program controls the windows startup sequence
mylen [45]

Of the different freeware and shareware programs available, two of the most popular are Xteq X-Start from Xteq Systems, and Startup Control Panel by Mike Lin. X-Start is a full-blown tweaking utility thats free for non-commercial use, and enables you to edit just about every element of a Windows system, including relevant startup and shutdown settings.

6 0
2 years ago
The pc card and cardbus devices are being replaced by what technology?
Ronch [10]
They are replaced by ExpressCard

3 0
2 years ago
Other questions:
  • ________ is an open-source program supported by the Apache Foundation that manages thousands of computers and implements MapRedu
    5·1 answer
  • Where to set up wireless network xbox one?
    5·1 answer
  • Write the definition of a method printarray, which has one parameter , an array of int s. the method does not return a value . t
    10·1 answer
  • X = 0
    15·1 answer
  • What are two advantages of encrypting data stored in the computer system?
    5·1 answer
  • python A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun
    15·2 answers
  • What is the output of the following program?
    10·1 answer
  • How would you copy all files from a remote directory into your LOCAL home folder.
    6·1 answer
  • A vacuum tube that contains a grid can be classified as a A. rectifier B. triode C. pentode D. diode
    12·1 answer
  • Consider the following code:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!