Create a java program that initialize a two dimensional array with the continuous assessment marks used to determine the semester mark for PRG510S exam qualification, The system should also create an array of student names in correspondence to the marks (Note: the appropriate weights of each individual assessment are given under corresponding headings and both the marks and student names are read from the user input).
test1
(Weight 20%)
test2
(Weight 20%)
labs
(Weight 20%)
in_class exercise
(Weight 10%)
assignment
(Weight 30%)
John
50
60
79
89
63
Harry
41
52
68
56
40
Uushona
30
20
52
38
47
Sililo
23
33
45
19
27
Enter class size: 3
Enter student name:John
Enter John’s semester marks: 50 60 79 89 63
Enter student name:Harry
Enter Harry’s semester marks: 41 52 68 56 40
Enter student name:Uushona
Output1:
Student Semester mark Qualifies for Exam?
--------- ------------------- -----------------------
John 66 YES
Harry 50 YES
Uushona 38 NO
Problem Statement: Implementing Polymorphism using abstract class and interface
Define Vehicle interface,AbstractManufacturer abstract class,Car class,Bike class and VehicleService Class as given below:
Interface Vehicle
create abstract method. +maxSpeed(String type) : int
Abstract class AbstractManufacturer
Declare private properties.
name : String
modelName : String
type : String
Provide getter for all properties
Declare abstract method +getManufacturerInformation() : String
Car Class
Make the class as subclass of Vehicle and AbstractManufacturer.
Define parameterized constructor passing three parameters to initialize name,modelName and type.
Override the abstract methods and follow the instructions given as comments for the business logic.
Bike Class
Make the class as subclass of Vehicle and AbstractManufacturer.
Define parameterized constructor passing three parameters to initialize name,modelName and type.
4. A Java interface can only contain method signatures and fields. The interface can be used
to achieve polymorphism. In this problem, you will practice your knowledge on interfaces.
You are given an interface AdvancedArithmetic which contains a method signature int
divisor_sum(int n). You need to write a class called MyCalculator which implements the
interface.
divisorSum method just takes an integer as input and return the sum of all its divisors. For
example divisors of 6 are 1, 2, 3 and 6, so divisor_sum should return 12. The value of n will be
at most 1000.
When a subclass inherits from a superclass, it also inherits its methods; however, it can
also override the superclass methods (as well as declare and implement new ones). Consider
the following Sports class:
class Sports{
String getName(){
return "Generic Sports";
}
void getNumberOfTeamMembers(){
System.out.println( "Each team has n players in " + getName() );
}
}
Next, we create a Soccer class that inherits from the Sports class. We can override the
getName method and return a different, subclass-specific string:
class Soccer extends Sports{
@Override
String getName(){
return "Soccer Class";
}
}
Each team has 11 players in Soccer Class
Finish the Teacher constructor. Use super to use the Person constructor to set the fields
inherited from Person. It should print “Destini 20” followed by “Erica 55 Masters in Teaching”.
public class Person
{
private String name;
private int age;
public Person(String name, int age)
{
this.name = name;
this.age = age;
}
public String getName() { return this.name; }
public int getAge() { return this.age; }
public String toString()
{
return getName() + " " + getAge();
}
public static void main(String[] args)
{
Person p = new Person("Destini", 20);
System.out.println(p);
Teacher p2 = new Teacher("Erica", 55, "Masters in Teaching");
System.out.println(p2);
}
}
class Teacher extends Person
{
String degree;
public String getDegree() { return this.degree; }
public String toString()
{
return getName() + " " + getAge() + " " + getDegree();
}
public Teacher(String name, int age, String theDegree)
{
// ADD CODE HERE
}
}
Q1. Write a Java method to compute the future investment value at a given interest rate for a
specified number of years.
Input the investment amount: 1000
Input the rate of interest: 10
Input number of years: 5
Years FutureValue
1 1104.71
2 1220.39
3 1348.18
4 1489.35
5 1645.31
The application should prompt the owner for a login confirmation code after their have enter the pin. Once logged in system will then offer the following options to the admin, the privilege to restock/ add new items to the vending machine, change prices, Cash out certain amounts from machine, cash in certain amount, print out a summary of all items in stock, print out amount of cash in categories(How many 100s, 50s up to 5cs)and print out only items that need restocking or exit, create a menu for this options. [ When cashing out/in amounts the owner indicates how many 100s, 50s and so on,] The customer should be able to buy items and get a receipts with all details of items bought, one can buy more than one items. The printed receipt contains the following details: the item name, quantity, price and total, it should also give a description of the change given out Your change is disbursed as follows: N$100 X 1, N$10X1, N$5X1 ,N$1X3,10centsX3 and 5centsX1. Provide codes, flowchart, pseudocode
The application should prompt the owner for a login confirmation code after their have enter the pin. Once logged in system will then offer the following options to the admin, the privilege to restock/ add new items to the vending machine, change prices, Cash out certain amounts from machine, cash in amount, print out a summary of all items in stock, print out amount of cash in categories(How many 100s, 50s up to 5cs)and print out only items that need restocking (all items below 25 need ) or exit, create a menu for this options. [ When cashing out/in amounts the owner indicates how many 100s, 50s and so on] The customer should be able to buy items and get a receipts with all details of items bought, can be able to buy more than one items. The printed receipt contains the details: the item name, quantity, price and total, it should also give a description of the change given out. Your change is disbursed as follows: N$100 X 1, N$10X1, N$5X1 ,N$1X3,10centsX3 and 5centsX1. Do the codes, pseudocodes, flowchart