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 simulates the ATM interface.



     Use a do-while loop to display 6 services to the user



     Get the user input and display submenus appropriately

(1) Stop words are high-frequency words that are removed from the representation of


natural language data. Write a method deleteStopwords(input, stopwords) that


deletes a list of words stopwords from some text input. It is up to you whether your


method expects input to be a referring to the source of the text to be processed, or a


String or ArrayList of words; similarly, for the stopwords parameter. However, you


should try to optimise the data structure used. Your method should return an ArrayList


containing the non-stop words identified. Your method should work successfully with


the contents of the input file Input.txt and the stop words listed in the file


stopwords.txt (both files are available on Learning Central).


[15 marks]


(Functionality: 8, Design: 4, Ease of use: 2, Presentation: 1)

Q2. Write a program for: search(LA,ITEM) in Java


1. Search whether the user's entered item is exist or not in the array if exist perform


following


2. Print two right neighbors(item/value) in case no right neighbor print message 'no right


neighbor'


3. Print two left neighbors(item/value) in case no left neighbor print message 'no left neighbor'

Q1. Write a program for: insert(LA, K, ITEM )


1. K is not out of range


2. Item must be positive integer


3. Check user's entered ITEM at index K is greater or less than in an array at index K, if less


than insert it into the array otherwise not perform any operation, and prints the


message 'ITEM’ at index k is greater than user's entered ‘ITEM'

Write a code to find unique number of vowel in str

Explain what is meant by the syntax and the semantics of a programming language. Give Java examples to illustrate the difference between a syntax error and a semantics error.

import java.io.BufferedReader;






2 import java.io.InputStreamReader;






▾ class Main {






T public static void main(String args[]) throws Exception {






BufferedReader br = new BufferedReader(new InputStreamReader (System.in)); // read the name from the input






String input_from_question br.readLine();






//Write your answer here






// print the Output






System.out.println(input_from_question);

Write a java program for Tlhogi’s Car Care Shop that shows a user a list of available services: oil change, tire rotation, battery check, or brake inspection. Allow the user to enter a string that corresponds to one of the options, and display the option and its price as R25, R22, R15, or R5, accordingly. Display an error message if the user enters an invalid item. Save the file as CarCareChoice.java.




It might not be reasonable to expect users to type long entries such as “oil change” accurately. Modify the CarCareChoice class so that as long as the user enters the first three characters of a service, the choice is considered valid. Save the file as CarCareChoice2.java.




Finally write a test class to test both classes. Save the file as TestCarCareChoice.java

The Program shall:

  • contain an arrow of 10 multiple choice questions with three (3) choices each
  • requires the user to choose among A, B, or C;

Note: Cases are ignored. Lowercase letters are acceptable (a, b, c).

Create a try-catch structure to handle three (3) exceptions. These are when the user inputs the following:

  • an invalid letter (not A, B, or C)
  • a number or any special character
  • blank (no answer)

Prompt the user that he can answer again if any of the three (3) exceptions is thrown

Display the score.


Write a program to calculate the correct packaging system for chocolates.  A user has the option to put it in a box, or put it in a box inside a container.  A box of chocolate bars can hold 30 bars and a container can hold 94 boxes of chocolates. Write a program that prompts the user to enter the total number of chocolate bars. The program then outputs the number of boxes and/or the number of containers to ship the chocolates. Note that each box must contain the specified number of chocolates each container must contain the specified number of boxes. If the last box of chocolates contains less than the number of specified chocolates you can discard it, and output the number of leftover chocolate. Similarly, if the last container contains less than the number of specified boxes, you can discard it, and output

the number of leftover boxes.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS