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

Java Data Types Assignment?



Object [ ] = { “Java”, 1.23F, true, false, 23, ‘a’, ‘b’, 23.4F, 45.6F}; Write the Java Program to sum only the float variables or any data type.

Write a program that allows the user to input a name, surname and address. The program should output the name, surname and address 10 times. Use the For and WHILE LOOP. 

2. Write a program using the SWITCH CASE Statement to enable the user to choose from 4 different operations as listed below. 

1) Sum (+) 

2) Minus (‐) 

3) Multiplication (*) 

4) Division (/) 

5) Exit 

The user will input two numbers and will then choose the operation from the menu above. The program will then work the operation chosen by the user and display the result accordingly. Loop the whole program until the user presses ‘5’

3. Write statements that will read numbers and print out the sum of thenumbers. The program should stop when the user enters -999, or after reading 5 numbers, whichever comes first.

4. Write a program segment using nested loops to create the following

output:

 

*

**

***

****

*****

******

*******

********

*********


: complete the question in the comments


The characters don’t need to be in particular order. For example, the characters [“y”, “r”, “o”, “u”] are needed to form the words [“your”, “you”, “or”, “yo”] Note: the input words won’t contain any spaces; however, they might contain punctuation and/or special characters. Sample Input words = ["this", "that", "did", "deed", "them!", "a"] Sample Output ["t", "t", "h", "i", "s", "a", "d", "d", "e", "e", "m", "!"] Solution Instruction ● You can submit your solution in the programming language of your choice. Y


Problem Statement- Write a function that takes in an array of words and returns the smallest array of characters needed to form all of the words. The characters don’t need to be in particular order.





Sample Input words = ["this", "that", "did", "deed", "them!", "a"]





Sample Output ["t", "t", "h", "i", "s", "a", "d", "d", "e", "e", "m", "!"]



● Please don’t write any main function, focus on writing the given function. A sample function signature is given below (for Java)



class Program { public char[] minimumCharactersForWords(String[] words)


{


// Write your code here.


return new char[] {};



}



}



Write a program that contains three threads. The first reads a letter and repeats the display of lines of increasing number of that letter. The second and third threads will do the same with other letters. Run this program which executes these threads simultaneously. The program and an output of a sample run are required.


Notice :use java language +I need the program to be in one class

An Execution Sample:

A

AA

AAA

B

BB

BBB

C

CC

CCC

AAAA

AAAAA

AAAAAA

BBBB

BBBBB

BBBBBB

CCCC

CCCCC

CCCCCC


1 Context An Adapter pattern acts as a connector between two incompatible interfaces that otherwise cannot be connected directly. An Adapter wraps an existing class with a new interface so that it becomes compatible with the client’s interface.

2 Problem description In this work, you will manage a printer room. There are two printers in the printer room, one char printer and the other one for char array. Depending on the printer selected, the job will either be printed in char or according to the limit, such as a char buffer.

3 Measure of success You are expected to implement necessary classes for this example using Facade Pattern. Output should be as in the pictures.


Write a Java GUI application that will keep track of a company's products. The application must contain the product id, product name and the product price.


On the form, create three text fields t capture the product details and a non editable text area to display the product details. Create a submit button that when clicked will save the product details to a products.txt file. Also include a search button that will allow a user to search for a product based on the product Id.


Create a sequential file (products.txt) that contains data for the following fields:


The product Id, The product name and price


Load the product details from the products.txt file. Populate the text area form load and whenever the new product us saved.


When the search button is clicked, promt the user with an Input box to enter in the product id. Based on the product id, display the name and product price.


Develop a Java GUI application that will display the ink cartridge usage of three different printers with a time span of three years.


Q.1.1 On the form, create two combo boxes, to allow a user to select between three different printers and years. When a user has selected a printer and year and clicked the submit button, display the amount of ink cartridges used for that year. Use the following table for the printers and yearly cartridges used: 2018 2019 2020 HP Deskjet 650 10 35 20 Epson K750 15 22 12 Canon Z100 30 31 33


Q.1.2 You are also required to create a menu system which will allow the user to exit the application under the file menu. Under the tool’s menu, allow the form submission and an option to display the yearly ink cartridges used for each printer. The layout of the form is left to your discretion.


Q.1.3 The application must display a report of each printer and the total ink cartridge used for the three different years.


On the form, create a list box that will allow the user to select a contact name, which is populated from a text file. Also create a search button that when clicked will display the mobile number, work number and email address.


Create a sequential file (contacts.txt) that contains data for the following fields:

The contact name;

The contact mobile number;

The contact work number;

The contact email address.


Load the data from the contacts.txt file and populate the list box with the contact names. Include a feature to inform the user on the amount of contacts.


1. Consider the following program, what is the output? (5 marks)

class overload

{

int x;

double y;

void add(int a , int b)

{ x = a + b; }

void add(double c , double d)

{ y = c + d; } overload()

{ this.x = 0;

this.y = 0;

}

} class Overload_methods

{ public static void main(String args[])

{

overload obj = new overload();

int a = 2; double b = 3.2;

obj.add(a, a);

obj.add(b, b);

System.out.println(obj.x + " " + obj.y); 


LATEST TUTORIALS
APPROVED BY CLIENTS