how long do you take to finish an assignment? mine is due 7th Nov 11:59pm
Constructor
public Vehicle () {
maxLoad=14.5;
}
// default constructor
public Vehicle ()
{
}
public Vehicle (int a, int b)
{
//////
}
Call method form main method
Vehicle x= new Vehicle ( );
x.setMaxLoad(14.5);
Question1: According to Syntax in above, specify class name and its modifier?Question1: According to Syntax in above, specify class name and its modifier?Playing game program for water sort puzzle
Write the code below for the two interfaces described given the rules below.
The Network has two methods called connect and disconnect. The connect method takes a String argument called networkName and returns a boolean. The disconnect method returns a boolean and takes no arguments.
The Ethernet interface inherits from the Network interface and adds two methods: plug and unPlug. The plug method takes an integer as argument called port and returns a boolean. The unPlug method returns a boolean and takes not arguments.
InstructionsPerform the following items. Mobile users may write their answers on a clean sheet of paper. (8 items x 5 points)
Write a class Battery that models a rechargeable battery.
totalCapacity: double
availableBattery: double;( this contains battery charge available)
String company;
· having no parameter – for setting values to zero or null.
· having two parameters for assigning values to both data members.
· Overload the above constructor and use this keyword to set the values of data members
· Provide getters and setters for data member(s).
· The method public void drain (double amount) drains the capacity of the battery by the given amount.
· The method public void charge (double amount) charges the battery by adding amount to availableBattery make sure it’s less than totalcapacity.
· A method toString to print object data.
1. Inside main, create 3 objects.
a. Set values of first object using constructor.
b. Take data from user and set the values for the 2 objects and display values.
2. Call all the above methods (drain, charge) and display updated values.
Suppose you want to deposit a certain amount of money into a savings account, and then leave it alone to draw interest for the next 10 years. At the end of 10 years, you would like to have $10,000 in the account. How much do you need to deposit today to make that happen? You can use the following formula, which is known as the present value formula, to find out: The terms in the formula are as follows: • P is the present value, or the amount that you need to deposit today. • F is the future value that you want in the account. (In this case, F is $10,000.) • r is the annual interest rate. • n is the number of years that you plan to let the money sit in the account. Write a method named presentValue that performs this calculation. The method should accept the future value, annual interest rate, and number of years as arguments. It should return the present value, which is the amount that you need to deposit today.
Problem:
Write a Java program that will convert a number(x) in base r to base 10.
The program should also meet the following requirements:
· Base r is an input and must be validated ; r is from 2 to 9 only
· The number x is an input and must be stored in an int type variable. Do not convert x to
string.
· Use of String type variable is not allowed.
· Use of arrays is not allowed.
· Use of built-in method that converts a given number to another base is not allowed.
· Your program should execute for as long as the user wants to continue
Assume that the user will input a valid number.
Note: This program converts X^r to Y^10
Where :
X^r - a number in base r
r – is from 2 to 9 only
Y^10 – the equivalent number in base 10
Write a Java class Complex for dealing with complex number. Your class must have the following features:
o Having no parameter – for setting values to zero or null.
o Having two parameters for assigning values to both data members.
o Overload the above constructor and use this keyword to set the values of data members