Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

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 & Filtering

Write a program that checks a text file for several formatting and punctuation matters. The program asks for the names of both an input file and an output file. It then copies all the text from the input file to the output file, but with the following two changes: (1) Any string of two or more blank characters is replaced by a single blank; (2) all sentences start with an uppercase letter. All sentences after the first one begin after either a period, a question mark, or an exclamation mark that is followed by one or more whitespace characters.
Write a program that reads a file of numbers of type int and writes all the numbers to another file, but without any duplicate numbers. Assume that the numbers in the input file are already ordered from smallest to largest. After the program is run, the new file will contain all the numbers in the original file, but no number will appear more than once in the file. The numbers in the output file should also be sorted from smallest to largest. Your program should obtain both file names from the user. Use either a text file or a binary file. For the text-file version, assume one number per line. For the binary-file version, use numbers of type int that are written using writeInt.
Write a program that searches a file of numbers and displays the largest number, the smallest number and the average of all the numbers in the file. Do not assume that all the numbers in the file are in any special order. Your program should obtain the file name from the user. Use either a text file or a binary file. For the text-file version, assume one number per line. For the binary-file version, use numbers of type double that are written using writeDouble
Suppose that you are in charge of customer service for a certain business. As phone calls come in, the name of the caller is recorded and eventually a service representative returns the call and handles the request. Write a class ServiceRequests that keeps track of the names of callers. The class should have the following methods:
addName (name) – adds a name to the list of names. Throws a ServiceBackUpException if there is no free space in the list.
removeName (name) – removes a name from the list. Throws a NoServiceRequestException if the name is not in the list.
getName(i) – returns the i’th name in the list.
getNumber – returns the current number of service requests.
Write a program that uses an object of type ServiceRequests to keep track of customers that have called. It should have a loop that, in each iteration, attempts to add a name, remove a name, or print all names. Use an array of size 10 as the list of names.
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.
Create a java program that will count all words in a sentence. The program should have a
minimum of two classes.
1.1 The first class should be named class1, this class will have the following:
 The main method (starting point) (5)
 The object of class2 (5)
 Should also call the get method count_words(String str) (5)
1.2 The second class should be named class2, this class should have the following:
 A constructor (5)
 A get method named count_words(String str) (10)
1.3 Constract a flowchart for class1 and class2 both combined. (10)
Hello, you must be willing to work on a small javafx project that is 80% done. Further details can be submitted along with .txt, pictures, and javacode needed for the completion of the project.
Modify the following method to use a for loop instead of the while loop:
public static void sumTo()
{
int n; int total = 0; int count = 0;
String output = “”;
String str;
str = JOptionPane.showInputDialog(“Give me a number to sum to: “);
n = Integer.parseInt(str);
while (count ,= n)
{
total = total + count;
output += count +”:\t” + total + “\n”;
count = count + 1;
}
JOptionPane.showMessageDialog(null, output);
}
Write a program to perform a VAT calculation and print the result on the screen. The program is to calculate the value-added tax (VAT) to be paid on a purchase price of R50. The current rate of VAT is 17.5%. The calculation required is therefore: (17.5 * 50) /100
3.1 Define the following concepts below:
3.1.1 Algorithm (3 marks)
3.1.2 Comments (3 marks)
3.1.3 Class (3 marks)
3.1.4 Semantic error (3 marks)
3.1.5 Applications Programming Interface (API) (3 marks)
3.2 To do useful work, programs must be able to operate on data such as numbers, characters etc, and these data items must be stored in the computer’s memory. This is done using variables, which are named pigeon holes in memory. Discuss the appropriate ways to name variables. (10 marks)
3.3 List FIVE (5) reasons why a comment should be placed at the start of the program. (5 marks)
LATEST TUTORIALS
APPROVED BY CLIENTS