Java | JSP | JSF Answers

Questions answered by Experts: 3 611

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

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


### Functional Interfaces and Lambda Expressions

------------------------------------------------

1. In the class LambdaExercise, create following static variables

1. countries of type List<String>

2. countryCapitals of type Map<String, String>

In a static block, initialize countries and countryCapitals with soe values

Define following static methods and provide the implementation as given below

- sortCountriesBylength

- Sort the List using Comparator, in descending order of number of characters in the country name.

If the number of characters are same for a country, it should be sorted alphabetically

(Use Comparator's static/default methods)

- removeCountry(String name)

- remove the countries whose name is greater than 6 characters

Execute the methods and display the results in main method



Stream operation


Define a POJO class Country with countryId and CountryName as member variables


- Define a POJO class Player with playerName, matchesPlayed, runs, highestScore, Country as member variables




- Create a class StreamOperationsExercise as below


- Create a List of Players, as a static variable, with some player objects



Define following static methods and provide the implementation using Java 8 streams API as given below




- displayPlayersForCountry(String country)


Display the name of players whose highest score is more than 100 and belong to a particular country



- getPlayerNames


Return a LinkedList containing names of all Players, whose have scored more than 5000 runs, sorted in descending order of names




- getAverageRunsByCountry(String country)


Return the average runs scored by players from a particular Country



- getPlayerNamesSorted


Return a list with names of Players sorted as per country and then by matchesPlayed(descending)



Execute the above methods in the main method.










































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)

  1. Create a constructor named Exam that assigns "Good luck" to a previously declared String variable named message.
  2. Create an empty overloaded constructor for the Exam class with two (2) String parameters named period and level.
  3. Declare a double-type accessor named getPrice that returns the value of price.
  4. Declare a boolean-type accessor named isFinished that returns the value of status.
  5. Declare a class named Midterm that inherits from the class named Exam.
  6. Create three (3) class declarations to show multiple levels of inheritance. Use the classes named Exam, Midterm, and Essay.
  7. Create a constructor named Midterm that prints "Exam has started." using println(). Its first statement should be a call to a constructor in the parent class.
  8. Given the base class named Quiz and the derived class named Essay, write a statement to show inheritance between these classes.

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.


LATEST TUTORIALS
APPROVED BY CLIENTS