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
Write a class Battery that models a rechargeable battery.
Capacity: double
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 () charges the battery to its original capacity.
· 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.
Write Java code for implementing arrays that accepts user inputs and then displays them. Take different arrays like this: stringArray, integerArray, doubleArray.
(a) Write Java code for implementing arrays that accepts user inputs and then displays them. Take different arrays like this: stringArray, integerArray, doubleArray.
1. Create a program that will convert the input dollar(s) into its equivalent peso. One dollar is approximately equal to 50.60 pesos. Then display The result.
Sample output:
The equivalent of $100 into is Php5,060.00
1. Create a program that will convert the input dollar(s) into its equivalent peso. One dollar is approximately equal to 50.60 pesos. Then display The result.
1. Create a program that will convert the input dollar(s) into its equivalent peso. One dollar is approximately equal to 50.60 pesos. Then display The result.
Sample output:
The equivalent of $100 into is Pho 5, 060.00
Using the above code add a method that takes in three arrays, one for student names, one for final test marks and a last one for assignment mark. The method should then calculate the students qualifying mark (a student needs 50 or more to qualify) using the following weights: 40% of the test and 60% of the assignment, finally print out whether the person qualified or not. [10]