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

what is the use of interfaces in java
5 by 20 array is declared in the Java code (e.g., Data [i][j])
Data[i][0] always has year information which is ranged between 2005 and 2018
Data[i][0] should be randomly assigned
Data[i][1~19] has a random integer which is ranged between 1~100
Create a program that satisfy the following requirements:
1. Ask user to enter integer numbers, one at a time.
2. If the number is -1, stop entering number.
3. Print out the total number that is greater than 18.


For example:
The following is screen shot when user enters the sentence “computer science is great”.

enter an integer:
13
enter an integer:
2
enter an integer:
21
enter an integer:
40
enter an integer:
-1
Total number that is greater than 18: 2
Write a program that converts dates from numerical month-day format to alphabetic month-day format. For example, input of 1/31 or 01/31 would produce January 31 as output. The dialogue with the user should be similar to that shown in Programming Project 2. You should define two exception classes, one called MonthException and another called DayException. If the user enters anything other than a legal month number (integers from 1 to 12), your program should throw and catch a MonthException. Similarly, if the user enters anything other than a valid day number (integers from 1 to either 29, 30, or 31, depending on the month), your program should throw and catch a DayException. To keep things simple, assume that February always has 28 days.
This week we will be working with throwing our exceptions and using try and catch blocks.

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

Throwing the Exceptions:


LotFullException: Adjust both of ParkingLot's park() methods to throw this exception instead of returning false if the ParkingLot is full and your Auto/Bicycle cannot be parked.

VehicleMissingException: Adjust ParkingLot's find() method to throw this exception instead of return null if the target vehicle is unable to be found inside the ParkingLot
Receive the names of corporations involved in this simulation as command-line arguments. Corporation names are guaranteed not to contain whitespace characters. For example, if your main method is in a class called Assignment07, then a command specifying two companies named Apple and WalMart would look like this:
java Assignment07 Apple WalMart
Maintain information about each corporation in an object that contains at least:
The corporation's cash on hand (initially $0)
The corporation's annual taxable income (initially $1 billion)
The corporation's annual tax-sheltered income (initially $0)
Process an arbitrary number of commands as input on standard input. Each command consists of one or three whitespace-delimited tokens, as follows:
taxable name value: Assigns a new amount of annual taxable income for the given corporation. name must be a valid name of a corporation, and value must be a decimal number in the range provided by Java's double type. For example:
taxable WalMart 10e9
Please if you can help me with this.. I would very much appreciate it.


import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int grade;
int nGrades = 0;
double sum = 0.0;
boolean done = false;
System.out.println("Enter grades (-1 to quit)");
while (!done) {
grade = scan.nextInt();
if (grade != -1) {
sum += grade;
nGrades++;
}
else {
done = true;
}
}
double average = sum / nGrades;
System.out.println("Average grade: " + average);
}
}


I need to be able to put grades -5 to 20
Use any other number as a sentinel value other than -5 to 20
fix NaN error that comes up if you input -1 and press enter
4. Use a simple array to implement queue.
3. Use a simple array to implement stack.
4. Write a program in Java to swap two numbers without using third variable.
For example if
a=5, and b=4 then after calling following function
Swap (int a, int b)
a=4 and b=5.
LATEST TUTORIALS
APPROVED BY CLIENTS