Question

Question 4 Not yet answered Marked out of 600 System.out.printin4 + 2-42) P Flag question In the table below, column A hastif Question 4 Not yet answered Marked out of 8 00 In the table below, column A has Java statements/expressions and column B

Question 6 (lab 07)

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lab07;

/**
*
* @author ckandjimi
*/
public class Lab07 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

int outcome = methodX(5);
System.out.printf("Result from Method X= %d",outcome);
String [] studentNames = {"Kingston","John","Nangula","Daniela"};
int Test01[] = {59,72,70,66};
int Test02[] = {80,65,55,49};
  
/**TASKS
* 1. Implement the 2 methods below assessment and highestMark
* 2. Using the 3 arrays declared above invoke or make a method call to assessment
* 3. Invoke highestMark using Test01 or Test02 arrays and store the results in test01Highest,
* test02Highest respectively
* 4. methodX has been fully implemented and Line 19 above makes a call to that function,
* create a table and record the outcomes when the function is called with the following
* arguments : methodX(-5) and methodX(0)
*
*/
  
  
  
}
public static void assessment(/*ADD YOUR PARAMETERS HERE*/){
/**
* This Function takes in 3 arrays one for student names, and 2 for the respective test marks
* We would like to print a list of students names,Test 01,Test 02 and final marks for each
* students(See sample), The final mark is 40% Test 01 and 60% Test 02.
* In the end we would like to print the sub total of all marks and average
* Use the below format for you print out:
* Name Test 01 Test 02 Final
* -------- ------- ------- -------
* Kingston 59 80 72
* John 72 65 68
* ----------------------------------------
* Sub-total 140
* Average 70
* ----------------------------------------
*/
  
}
public static int highestMark(/*ADD YOUR PARAMETERS HERE*/){
/**
* This Functions takes in an array of Marks and return the highest mark
*/
return 0; //Change this statement
}
public static int methodX(int n){
/**
* This function uses recursion to do some interesting calculations
* if the given number(n) is equal or less then 1 the functions returns 1(Stopping case)
* other wise the number(n) is multiplied by the result of the function methodX(n-2)
*/
if (n <= 1 )
return 1;
else
return n * methodX(n-2);
}
}

Question 4 Not yet answered Marked out of 600 System.out.printin"4 + 2-4"2) P Flag question In the table below, column A has Java statements/expressions and column B has possible outcomes or errors corresponding to each statement Choose System out printf("Amount: N$ % 2f"+ 350) System.out printf Amount: N$%.2f ,350) The statement if(! allowed) will evaluate to false when allowed System.out println( 8 7 && 88); System.out printin" 4 +2+ ((4>2)?"4+2" 4)) Choose Choose Choose true Choose Choose Question 5 Not yet answered Marked out of 2.00 P Flag question Which of the following array declaration is not valid in Java? Select one O a. int IlI marks 145, 67) 175,90) (54,77)); O b. double [INumbers 134.7, 90, 21.4, 18.9) O c. int [] evenNumbers (2, 4, 6, 8, "Ten" d. String Names ["Nujoma", "Kennedy", "Kenyata", "Trump","Mandela", "Mugabe" Question 6 Submit the implementation of LAB07 (Project provided to you). Additionally, answer the following questions A) What are the parameters of assessment) ? B) What are the parameters of highestMark)? C) What is the main condition used to determine the highest mark in the method highestMark) D) Fill-out the table below using the outcomes of method calls to methodX, see instructions in file provide (Instruction 4) Arguments e.g. 5 Marked out of 20.00 Outcome 15 E) Submit Word document/PDF or Picture that illustrates the trace to methodX) with 5 as an argument.
tif Question 4 Not yet answered Marked out of 8 00 In the table below, column A has Java statements/expressions and column B has possible outcomes or errors corresponding to each statement. System.out.println("42"4"+2); Choose. Choose true Amount: NS 350.00 Runtime eor: MissingFormatÄrgumentException 42 42 false Flag question System.out.printf("Amount NS %.2f"+350); System.out.printf("Amount NS%.2t..350); The statement if(lallowed) will evaluate to false when allowed System.out.println 8 7 && 8 8); System.out println("4+ 2((42)? 4+2 4")) true 4+2 4+2 Choose Choose.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 4

1. 4 + 2 = 42
2. Runtime error because this is not a comaptible format for "printf" function.
3. runtime error because %d is missing in the statement and thus there is no variable to assign a value 350 to.
4. The given statement is correct and hence True.
5. false
6. 4+2 = 4+2

Q5. int[] evenNumbers = {2,4,6,8,"Ten"} is NOT VALID in Java as we declared an array of integer data type (namely evenNumbers) but assigning a string "Ten" in it is invalid.

Add a comment
Answer #2
https://www.homeworklib.com/qaa/752123/question-6-lab-07-to-change-this-license-header#_=_
answered by: anonymous
Add a comment
Know the answer?
Add Answer to:
Question 6 (lab 07) /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. *...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java Programming Lab 07 coding /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in th...

    Java Programming Lab 07 coding /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package lab07; /** * * @author ckandjimi */ public class Lab07 { /** * @param args the command line arguments */ public static void main(String[] args) { int outcome = methodX(5); System.out.printf("Result from Method X= %d",outcome); String [] studentNames = {"Kingston","John","Nangula","Daniela"}; int Test01[]...

  • /* * To change this license header, choose License Headers in Project Properties. * To change...

    /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package checkingaccounttest; // Chapter 9 Part II Solution public class CheckingAccountTest { public static void main(String[] args) {    CheckingAccount c1 = new CheckingAccount(879101,3000); c1.deposit(350); c1.deposit(220); c1.withdraw(100); c1.deposit(1100); c1.deposit(700); c1.withdraw(350); c1.withdraw(220); c1.withdraw(100); c1.deposit(1100); c1.deposit(700); c1.deposit(1000); System.out.println(c1); System.out.println("After calling computeMonthlyFee()"); c1.computeMonthlyFee(); System.out.println(c1); } } class BankAccount { private int...

  • Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the...

    Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the following keywords is useful for skipping to the next iteration of a loop? Select one: a. do b. break c. switch d. continue e. while Clear my choice Question 2 Not yet answered Marked out of 1.00 Flag question Question text Consider the following line of Java code. System.out.println("Hello, World!"); "out" is which of the following? Select one: a. a statement b. a class...

  • Question 1 Question 2: Question 3: Question 4: Question 5: Question 6: Question 7: Question 8:...

    Question 1 Question 2: Question 3: Question 4: Question 5: Question 6: Question 7: Question 8: Please number each question. Thank you Question 1 Not yet answered Marked out of 4.00 Flag question If the number density of electrons in a wire is n 1.00 x 1028 m-3, at what drift velocity must they travel through a wire of diameter d 0.560 mm to deliver a current of 7.20 A? Give your answer in mm s1 to 3 significant figures...

  • This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named...

    This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...

  • Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C -...

    Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...

  • Question 1 Not yet answered Marked out of 100.00 P Flag question Analyzing Transactions and Adjustments...

    Question 1 Not yet answered Marked out of 100.00 P Flag question Analyzing Transactions and Adjustments Using the Financial Statement Effects Template On March 1, S. Penman launched AniFoods Inc., an organic foods retailing company. Following are the transactions for its first month of business. 1. S. Penman contributed $220,000 cash to the company in return for common stock. Penman also lent the company $121,000. This $121,000 note is due one year hence. 2. The company purchased equipment in the...

  • Question 2 - Programming Exercise 1. Make a directory for this lab and change into it....

    Question 2 - Programming Exercise 1. Make a directory for this lab and change into it. 2. Copy files using the following command: cp/net/data/ftp/pub/class/115/ftp/cpp/Inheritance/Exercise.cpp Exercise.cpp Finish the program so that it compiles and runs. The instructions are contained in the C++ file. Your completed program should generate output similar to the following: TwoD default constructor This program asks for the coordinates of two points in 3D space and calculates their distance. Please enter the xyz coordinates for the first point:...

  • Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such...

    Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such as declaration, initialization, storing, retrieving, and processing elements. • Effectively manipulating and using ArrayList objects. • Becoming familiar with the use of arrays as method arguments and how array elements are passed to and returned from the called method. • Mastering the use of various debugging tools available on the Eclipse IDU. Important: EVERY one of the following Activities MUST be in a separate...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT