Discuss the difference between a PRETEST and POSTTEST loop. Briefly explain parallel arrays. What does immutable...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Discuss the difference between a PRETEST and POSTTEST loop. Briefly explain parallel arrays. What does immutable refer to? Given the following coding. private String GenerateStars(int x) { } String stars = ""; if (SALES[x]>=100) stars="****" } else{ } stars="**"; return stars; Explain the if statement. Discuss any two ways in which you could improve a loop performance. Q.5.3 Q.5.4 Q.5.5 Q.5.6 Write code to declare an array that will hold calendar months (.e. January to December). Take note: no need to do it practically using a compiler, just basic coding to declare an array and load calendar months as per question. Briefly explain what actual parameters are. consists of programming statements that have been compiled into binary format. (4) to encapsulate a series of statements. (2) (2) is the programming feature that allows you to use a method name (2) Q.3.1 Explain why an out of bounds error message may be generated when using arrays. Q.3.2 Distinguish in your own words between a sequence structure and a decision structure. Q.3.3 In programming terms, what is a token? Q.3.4 What are the four keywords used in a Switch Statement? Q.3.5 Explain what a Run-Time Error is. (2) (4) (2) (4) (2) Q.3.6 What does the following code output? int x = 8; int y = 2; while(x > 8) { X--; y+=2; System.out.println(y); } Q.3.7 What does the following code output? System.out.println((2 + 3 - 5) * (3/3) + (5+5)); Q.3.8 What does the following code output? if((2 == 2) && (3 != 3) && ((5 +1)==6)){ System.out.println(true); } else { } System.out.println (false); (2) (2) (2) Question 4 (Marks: 20) Debug the section of code that follows. Check the code carefully for all errors and list the line numbers, the errors and write the corrections to the errors as well. public class Watches { private WatchMake; private string SalesPerson; private double WatchPrice; Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 Line 11 Line 12 Line 13 Line 14 Line 15 Line 16 Line 17 Line 18 Line 19 Line 20 Line 21 Line 22 } public Watches(String make String sales Person, double price) { WatchMake = make; SalesPerson = salesPerson; WatchPrice = price } public String getWatch { return WatchMake; } public double getWatchPrice() { send WatchPrice; } public double getCommission(){ double pay_out >> 0.0; pay_out= WatchPrice *= 0.10; return pay out; Q.4.2 Q.4.3 Q.4.4 Q.4.5 Q.4.6 Explain the two parts that every method in Java must consist of. Distinguish between a sequence structure and a decision structure. When is a Switch Statement useful in programming? consists of programming statements that have been compiled into binary format. S 4 encapsulate a series of statements. (5) (4) (2) (2) is the programming feature that allows you to use a method name to (2) Question 5 Write the answers to the following questions. Q.5.1 Write short Java code to display the following screen (no need to do it practically (5) using a compiler, just basic coding to display the screen): Sample screenshot Q.5.2 TOP PROGRAMMING LANGUAGES APPLICATION Enter programming language 1: Java Enter the percentage of market usage for Java: 60 Enter programming language 2: C# Enter the percentage of market usage for C#: 25 Enter programming language 3: Python Enter the percentage of market usage for Python: 15 (Marks: 60) Explain the two parts that every method in Java must consist of. (5) Q.5.7 Write a method that calculates and returns an average as depicted in the following figure. Ⓒ The Independent Institute of Education (Pty) Ltd 2020 20 SALON SALLY SALON REPORT Jan >> 58 (2 4960.0) Jab >> 54 (2 6480.0) Mar 66 (R 7800.0) Apr 42 (R 6040.0) May 77 (2 9240.0) Jun >>49 (R 5000.0) Jul 5 (R 6600.0) Aug Sep Oct >> 53 (R 6360.0) Nov 60 (R 8160.0) Dec >> €2 (R 7440.0) 51 (R €120.0) 70 (R 0400.0) 12 CUSTOMER COUNT: AVERAGE CUSTOMERS: 59 (10) Page 10 of 13 2020 Q.5.8 Write short Java code to display the following screen (no need to do it practically (5) using a compiler, just basic coding to display the screen): Sample screenshot Input ? Enter (1) to display the vowel count. Enter (2) to display the non vowel count. Enter (0) to exit. OK X Cancel Discuss the difference between a PRETEST and POSTTEST loop. Briefly explain parallel arrays. What does immutable refer to? Given the following coding. private String GenerateStars(int x) { } String stars = ""; if (SALES[x]>=100) stars="****" } else{ } stars="**"; return stars; Explain the if statement. Discuss any two ways in which you could improve a loop performance. Q.5.3 Q.5.4 Q.5.5 Q.5.6 Write code to declare an array that will hold calendar months (.e. January to December). Take note: no need to do it practically using a compiler, just basic coding to declare an array and load calendar months as per question. Briefly explain what actual parameters are. consists of programming statements that have been compiled into binary format. (4) to encapsulate a series of statements. (2) (2) is the programming feature that allows you to use a method name (2) Q.3.1 Explain why an out of bounds error message may be generated when using arrays. Q.3.2 Distinguish in your own words between a sequence structure and a decision structure. Q.3.3 In programming terms, what is a token? Q.3.4 What are the four keywords used in a Switch Statement? Q.3.5 Explain what a Run-Time Error is. (2) (4) (2) (4) (2) Q.3.6 What does the following code output? int x = 8; int y = 2; while(x > 8) { X--; y+=2; System.out.println(y); } Q.3.7 What does the following code output? System.out.println((2 + 3 - 5) * (3/3) + (5+5)); Q.3.8 What does the following code output? if((2 == 2) && (3 != 3) && ((5 +1)==6)){ System.out.println(true); } else { } System.out.println (false); (2) (2) (2) Question 4 (Marks: 20) Debug the section of code that follows. Check the code carefully for all errors and list the line numbers, the errors and write the corrections to the errors as well. public class Watches { private WatchMake; private string SalesPerson; private double WatchPrice; Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 Line 11 Line 12 Line 13 Line 14 Line 15 Line 16 Line 17 Line 18 Line 19 Line 20 Line 21 Line 22 } public Watches(String make String sales Person, double price) { WatchMake = make; SalesPerson = salesPerson; WatchPrice = price } public String getWatch { return WatchMake; } public double getWatchPrice() { send WatchPrice; } public double getCommission(){ double pay_out >> 0.0; pay_out= WatchPrice *= 0.10; return pay out; Q.4.2 Q.4.3 Q.4.4 Q.4.5 Q.4.6 Explain the two parts that every method in Java must consist of. Distinguish between a sequence structure and a decision structure. When is a Switch Statement useful in programming? consists of programming statements that have been compiled into binary format. S 4 encapsulate a series of statements. (5) (4) (2) (2) is the programming feature that allows you to use a method name to (2) Question 5 Write the answers to the following questions. Q.5.1 Write short Java code to display the following screen (no need to do it practically (5) using a compiler, just basic coding to display the screen): Sample screenshot Q.5.2 TOP PROGRAMMING LANGUAGES APPLICATION Enter programming language 1: Java Enter the percentage of market usage for Java: 60 Enter programming language 2: C# Enter the percentage of market usage for C#: 25 Enter programming language 3: Python Enter the percentage of market usage for Python: 15 (Marks: 60) Explain the two parts that every method in Java must consist of. (5) Q.5.7 Write a method that calculates and returns an average as depicted in the following figure. Ⓒ The Independent Institute of Education (Pty) Ltd 2020 20 SALON SALLY SALON REPORT Jan >> 58 (2 4960.0) Jab >> 54 (2 6480.0) Mar 66 (R 7800.0) Apr 42 (R 6040.0) May 77 (2 9240.0) Jun >>49 (R 5000.0) Jul 5 (R 6600.0) Aug Sep Oct >> 53 (R 6360.0) Nov 60 (R 8160.0) Dec >> €2 (R 7440.0) 51 (R €120.0) 70 (R 0400.0) 12 CUSTOMER COUNT: AVERAGE CUSTOMERS: 59 (10) Page 10 of 13 2020 Q.5.8 Write short Java code to display the following screen (no need to do it practically (5) using a compiler, just basic coding to display the screen): Sample screenshot Input ? Enter (1) to display the vowel count. Enter (2) to display the non vowel count. Enter (0) to exit. OK X Cancel
Expert Answer:
Related Book For
Auditing a business risk appraoch
ISBN: 978-0324375589
6th Edition
Authors: larry e. rittenberg, bradley j. schwieger, karla m. johnston
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Data set Theory Assume an informational record with one association parent including matches (a, b) where a can't try not to be a parent of b. (a) Write a Datalog demand which gives the graph of...
-
Which of the following is NOT a factor to be considered in determining a limited-life intangible assets useful life? The expected useful life of any related asset All of the other answers are correct...
-
1. Kiss Greetings planned to raise $500,000 by issuing bonds. The bond certificates were printed bearing a stated interest rate of 6%, which was equal to the yield rate of interest. However, before...
-
Find the indefinite integral and check the result by differentiation. [ ( + ) ( 1 ) di dt
-
Mr. Tam is the front man for the Asian American dance-rock band The Slants. Mr. Tam named his band The Slants to reclaim and take ownership of Asian stereotypes. The band draws inspiration for its...
-
Haley Romeros had just been appointed vice president of the Rocky Mountain Region of the Bank Services Corporation (BSC). The company provides check processing services for small banks. The banks...
-
Why, in fact, does Marxism breed regimes which are totalitarian in nature? How does multiculturalism at play?
-
The Classic Furniture Company is trying to determine the optimal quantities to make of six possible products: tables and chairs made of oak, cherry, and pine. The products are to be made using the...
-
Write a paper on The impacts of trade remedy measures on Africa's international trade and economic growth a case study of Rwanda
-
Discuss how entertainment has shaped and been shaped society. Provide some examples. What are the benefits and challenges of having readily available entertainment at our fingertips? Shear (2019)...
-
select any crime control policy (e.g., the three-strikes law, legalization of recreational use of marijuana, combatting terrorism and the Patriot Act, gang initiatives, or gun control, etc.). In your...
-
Assume radix sorting of 1024 floats on a 32-bit machine with 8 passes (rounds). The floats are initially stored in Ist[1024] and the sorted floats will be available in 1st at the end of sorting....
-
mework Paper Company acquired 100 percent of Scissor Company's outstanding common stock for $370,000 on January 1, 20X8, when th book value of Scissor's net assets was equal to $370,000. Paper uses...
-
Linda T Sanchez introduce the US citizenship immigration act 2023 Summarize the journal article. Identify the key findings and issues as presented by the authors of the journal article. Summarize the...
-
A drunk starts out from a lamppost in the middle of a street, taking steps of equal length either to the right or to the left with equal probability. What is the probability that the man will again...
-
Consider the setup in Problem 16. Show that the relative speed of the ball and the point of contact on the stick is the same before and immediately after the collision. (This result is analogous to...
-
What are users interests in reports on internal control over financial reporting? Identify the factors that influenced congress in developing Section 404 of the Sarbanes-Oxley Act that requires...
-
Avation is a public company and, therefore, the auditor is required to test controls and issue an opinion on the effectiveness of the client's controls as well as the fairness of the financial...
-
A review of corporate failures as described in the financial press, such as The Wall Street Journal, often describes the tone at the top as one of the major contributors to the failure. Often the...
-
The simplified financial statements of Titanium Ltd appear below. Additional information 1. Dividends declared and paid were $26 400. 2. During the year equipment was sold for $10 200 cash. The...
-
An analysis of the accounts of Beautiful Bottles Pty Ltd reveals the following manufacturing cost data for the month ended 30 June 2019. Required (a) Prepare the cost of goods manufactured schedule...
-
The following accounts and amounts (balances are normal balances) were taken from the records of Prider Manufacturers Ltd at 30 June 2019. Required (a) Prepare a cost of goods manufactured statement...
Study smarter with the SolutionInn App