Find latitude and longitude of utmost 20 countries, ordered by population, with a population greater or equal to the population limit given below and have atleast one currency exclusively for themselves. (countries like Madagascar, Sri Lanka but not India, USA). Use the country details from this dataset.
Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.
Population limit: 31028700
Note: Population limit will change at random intervals. So please make sure answer is computed for the correct population limit before submitting.
A
method
addWin()
,
which
takes
no
arguments
and
increments
the
number
of
times
the
player has won.
•
A
toString()
method,
which
takes
no
arguments
and
returns
(as
a
String
)
the
player’s
name, followed by the number of points in parentheses.
For example, if the player’s name
is
Jeff
and the player has 25 points, you’ll return
"Jeff (25 points)"
.
note
that the auto-
grader is vary particular about the formatting of your return String here.
Getters
for
the
name
(
String
),
number
of
points
(
int
),
and
number
of
wins
(
int
).
These
should be called
getName()
,
getScore()
, and
getWins()
, respectively.
•
A method
addPoints()
, which takes in an
int
and adds that number to the total number of
points the user has.
•
A method
resetScore()
, which takes no arguments and resets the player’s score to zero.
A constructor which takes in a
String
, the player’s name.
If the
String
given is
null
or the
empty string (
""
), set the player’s name to a
unique
non-empty value (in my reference code,
I use ”Player 1”, ”Player 2”, etc).
Otherwise, set the name to the given
String
.
Score and
number of wins should both start at zero.
A constructor which takes no arguments. It sets the name to a
unique
non-empty string. (In
my reference code, I use ”Player 1”, ”Player 2”, etc).
Write statements that perform the following one-dimensional-array operations (To test the items a-e below, create an integer array called numbers with 10 elements. Array should be first pre-initialized with random numbers from 1-100) or You can create a user defined Array taking input from user
For each array element.
a) Crete a method that will return sum of all the elements of an integer array.
b) Crete a method that will return the highest number in the array.
c)Crete a method that will return the lowest number in array.
d) Display all the values of an array in column format.
e) Create a method that will reverse the array or create a method to get the Average of the array.
A processor method named upragedRAM(int) that receive the size of RAM to be upgraded as its parameter. This method will determine and return the price of RAM based on the following table:
RAM Size Price(RM)
8GB 98.00
16GB 299.00
3. Write main program :
a. Declare an array of objects named Laptops that store 10 laptop objects.
b. Ask user to enter all information required and store the data in the array above.
c. Calculate and display the total price of all Acer laptops
d. Display the brand of laptop thatt provides 4 USB ports
Given the definition of Laptop class as follows:
public class Laptop
{
private String brand; //HP, Acer, ASUS
private double price; //price per unit
private int RAM; // memory space in GigaByte(GB),e.g:2,4
private int USBport; //number of USB port e.g:2, 3, 4
//normal constructor: public Laptop (String, double, int, int)
//processor method: upradeRAM(int)
//accessors: getBrand (), getPrice(), getRAM(), getUSB()
}
1. Write full class definition for the Laptop class.
c) Streamyx subclass has a method named calcBill() which returns the amount the customer
has to pay monthly. The amount is calculated based on the package type chose by customers
during their installation and how long they use the service (as shown in the table below).
Package Type Usage
Time(minutes)
Amount Billed(RM)
Broadband Unlimited access 68
Normal
<= 480 0.30 per minute
480 0.15 per minute
Business <= 240 0.50 per minute
> 240 0.30 per minute
Write the method calcBill() for the Streamyx subclass.
(8 marks)
d) Telephone subclass has a method named calcBill() which returns the amount the customer
has to pay monthly. The amount is calculated based on monthly fee (RM30.00) plus the minute
used by customers as below:
A three minutes telephone call costs RM1.15. Each additional minute costs 26
cents.
e) Write an application to display all the details of object Telephone and streamyx.
f) Change the class TMPoint to abstract class and add calcBill as an abstract method.
Given the following classes and inheritance hierarchy which are used to store various types of
communication services provided by TMPOINT previously known as Telekom Malaysia :
and the following definition for the TMPoint class :
public class TMPoint
{ String phoneNo;
String custName;
String dateinstall;
double installFee;
//constructor
//accessor methods
}
Streamyx class is inherited from class TMPoint. Its new attribute is package type and usage time.
Telephone class is also inherited from class TMPoint. Its new attribute is minuteUsed.
a) Define the constructor for superclass TMPoint and its subclass Streamyx and Telephone.
(8 marks)
b) Write the accessor and setter methods for each attribute from the superclass and subclasses.
(4 marks)
How can I Write a Java programming
1.ask the use input the username
2.input the name in next line
and it can be content the student class
System.out.println(|Student Name : |)
use “ SList [i] getStudentname “
and display after the Student Name : Ada Sze
hins:
use for loop
do
while
else