Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HOMEWOR 6 rite a method that takes as inputs (1) an integer value t (2) an array of integers called A1]. The method returns two

image text in transcribed

HOMEWOR 6 rite a method that takes as inputs (1) an integer value t (2) an array of integers called A1]. The method returns two integer values representing the indices of the input array A1[ that add up to the value t. Note the method akes an array as parameter (one of the two parameters) and its return type is also an integer array of length two Write also code for calling the method twice in the same array and show screenshot of the output Input: Al Output: x,y where Al[x] +AILy]-; for example, if the input is A10 1,2,3,4,5,6] and -7; then the output should be [1, 4] becaue A1[1]+A1[4] 7 2) Java: write code to declare and create an array named Qbc of length 200 integer elements, then assign the valu 321 to the 2nd element of Qbe; (b) Then, assign the sum of the third and fouth to the fifth elements of Qbc 3) Use one statement to decrement the variable q by 1, then subtract it from variable myTotaland store the result in variable myTotal 4) Given the following clases: public abstract class Emp ...) public class SalariedEmp extends Emp) public class HourlyEmp extends Emp {...) public class CommissionEmp extends Emp (...) public class BasePlusCommissionEmp extends CommissionEmp (...) determine for each of the following if correct or incorrect (a) Emp[4] Emps] new Emp[ 4 ]; (b) HourlyEmp Emp2- new Emp: )SalariedEmp salariedEmp new SalariedEmp( (d) Emp salariedEmp new SalariedEmp( new Emp( new salariedEmp Emps[ 0] salariedEmp; (g) Emps[ 0] SalariedEmp; (i) Emp Emps] new Emp[ 4 ] (G) Emp[] Emps[] new Emp[ 4]: (f) SalariedEmp salariedEmp ); (h) SalariedEmp SalariedEmp2 5) Each class can be declared to be either.... . ....,..... . ,or or some combination of the three, by using the appropriate modifiers ahead of the keyword class in the class declaration (fill in 3 spaces) 6) Show the proper syntax for declaring, instantiating, and initializing a reference variable of type Double 7) Write one C program that creates three (children) processes. One of the created processes just prints its process Id number and terminates. One process creates two threads (one thread for printing odd numbers and one for printing even numbers 0- 100). One process calculates and prints the first 10 nmbrs in the fibbonaci sequence. HOMEWOR 6 rite a method that takes as inputs (1) an integer value t (2) an array of integers called A1]. The method returns two integer values representing the indices of the input array A1[ that add up to the value t. Note the method akes an array as parameter (one of the two parameters) and its return type is also an integer array of length two Write also code for calling the method twice in the same array and show screenshot of the output Input: Al Output: x,y where Al[x] +AILy]-; for example, if the input is A10 1,2,3,4,5,6] and -7; then the output should be [1, 4] becaue A1[1]+A1[4] 7 2) Java: write code to declare and create an array named Qbc of length 200 integer elements, then assign the valu 321 to the 2nd element of Qbe; (b) Then, assign the sum of the third and fouth to the fifth elements of Qbc 3) Use one statement to decrement the variable q by 1, then subtract it from variable myTotaland store the result in variable myTotal 4) Given the following clases: public abstract class Emp ...) public class SalariedEmp extends Emp) public class HourlyEmp extends Emp {...) public class CommissionEmp extends Emp (...) public class BasePlusCommissionEmp extends CommissionEmp (...) determine for each of the following if correct or incorrect (a) Emp[4] Emps] new Emp[ 4 ]; (b) HourlyEmp Emp2- new Emp: )SalariedEmp salariedEmp new SalariedEmp( (d) Emp salariedEmp new SalariedEmp( new Emp( new salariedEmp Emps[ 0] salariedEmp; (g) Emps[ 0] SalariedEmp; (i) Emp Emps] new Emp[ 4 ] (G) Emp[] Emps[] new Emp[ 4]: (f) SalariedEmp salariedEmp ); (h) SalariedEmp SalariedEmp2 5) Each class can be declared to be either.... . ....,..... . ,or or some combination of the three, by using the appropriate modifiers ahead of the keyword class in the class declaration (fill in 3 spaces) 6) Show the proper syntax for declaring, instantiating, and initializing a reference variable of type Double 7) Write one C program that creates three (children) processes. One of the created processes just prints its process Id number and terminates. One process creates two threads (one thread for printing odd numbers and one for printing even numbers 0- 100). One process calculates and prints the first 10 nmbrs in the fibbonaci sequence

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago

Question

Define promotion.

Answered: 1 week ago