We want to calculate the total marks of each student of a class in Physics, Chemistry
and Mathematics and the average marks of the class. The number of students in the
class is entered by the user. Create a class named Marks with data members for roll
number, name and marks. Create three other classes inheriting the Marks class,
namely Physics, Chemistry and Mathematics, which are used to define marks in
individual subject of each student. Roll number of each student will be generated
automatically.
a) Write a CD class that extends the Item class. CD’s have a String artist field and an int playingTime field. This class should have appropriate constructors, getters and setters and should override the toString method and the depreciate method. CD’s depreciate by 10%. b) Write a DVD class that extends the Item class. The DVD class has a String director (the director of the movie) and an int runningTime (how long the movie is). Remember to provide the appropriate constructors, getters and setters and to override the toString method and the depreciate method. DVD’s depreciate by 15%
Write JSP programs which can perform the following tasks: (you may create a single or multiple web pages for these tasks): (i) A page requires input of three variables a, b, and c, it then finds and displays the largest of these three variables. Write the JSP code for the above. (ii) Create a login page for students which should create two cookies namely userID and password on successful login by a student.
The Super-class Write a class called Item. The Item class represents all that is common between various multimedia items. It should have the following attributes (fields): a) a String name to store the name of the item. b) a String comment to store a comment about the item. c) a double value to store how much the item cost. It should have appropriate constructors and at least the following methods a) getters and setters for the attributes. b) a public String toString() method that returns a String representation of the Item. c) a method void depreciate() that decreases the value of the item by 5%.
Edit and complete this linked list code to ASK and DISPLAY, how many members, 1st, middle, lastname, area code, tel number, gender, age
import java.io.*;
public class FinalNode {
public int data;
public FinalNode next;
public static FinalNode firstNode;
public static FinalNode lastNode=null;
public FinalNode(int d,FinalNode n)
{
data=d;
next=n;
}
public static void main(String[] args) throws IOException{
int numnodes, num;
BufferedReader s= new BufferedReader(new InputStreamReader(System.in));
System.out.print("How many nodes to input? ");
numnodes = Integer.parseInt(s.readLine());
for(int i=0;i<numnodes;i++){
System.out.print("Enter node"+(i+1)+":");
num = Integer.parseInt(s.readLine());
FinalNode n =new FinalNode(num, null);
if(lastNode!=null)
{
lastNode.next=n;
lastNode=n;
}
else
{
firstNode=n;
lastNode=n;
}
}
System.out.print("entered nodes: ");
FinalNode n=firstNode;
while(n!=null)
{
System.out.print(n.data+"\t");
n=n.next;
}
System.out.println();
}
}
Java is known to be an object oriented program. Objects are also known to exist in real life. You have been invited as a computer science student to distinguish between real life objects and object found in object oriented program OOP (5 marks) b. Write an OOP to compare the risk factor that will lead to high payment of life insurance premium. The variables to consider are: age, weight, and height
Write an application that allows a user to enter any number of student test scores until the user enters 999. If the score entered is less than 0 or more than 100, display an appropriate message and do not use the score. After all the scores have been entered, display the number of scores entered, the highest score, the lowest score, and the arithmetic average.
java create a program that asks the user for the number of male and female students registered in a class/section. the program should display the total number of students and the percentage of males and females in the class
Create a class “Calculator” with two variables, a constructor with no parameter and two functions for add and multiply. Create a class TestApp with a main function and create object of Calculator class to call functions.
Create a class Calculator with two variables, a constructor with no parameter and
two functions for add and multiply. Add functionality for overloading sum and
multiply. Also call scientific functions using Math class (sine, cos, tan and power).
Create a class TestApp with a main function and create object of Calculator class to
call functions.