(a) Declare a local string variable id and initialize it with your 8-digit student ID in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(a) Declare a local string variable id and initialize it with your 8-digit student ID in string form. What is the output of the following program segment? String str = id + " "; // two spaces System.out.println(str.indexOf("5") + " + " + str.substring(0,2) + " " + str.trim().substring (5) + "%"); [2 marks] (b) The class List below is in java.util. What is the output of the following program segment? List aList = new Vector (); aList.add("one"); aList.add("two"); aList.add("three"); aList.add(2, "one"); aList.remove ("one"); System.out.println (aList + " " + aList.size()); [3 marks] (a) Declare a local string variable id and initialize it with your 8-digit student ID in string form. What is the output of the following program segment? String str = id + " "; // two spaces System.out.println(str.indexOf("5") + " + " + str.substring(0,2) + " " + str.trim().substring (5) + "%"); [2 marks] (b) The class List below is in java.util. What is the output of the following program segment? List aList = new Vector (); aList.add("one"); aList.add("two"); aList.add("three"); aList.add(2, "one"); aList.remove ("one"); System.out.println (aList + " " + aList.size()); [3 marks]
Expert Answer:
Related Book For
Essentials of Contemporary Management
ISBN: ?978-0077439477
5th edition
Authors: Gareth Jones, Jennifer George
Posted Date:
Students also viewed these programming questions
-
(A) Find the mean and standard deviation of the following set of ungrouped sample data. (B) What proportion of the measurements lies within 1 standard deviation of the mean? Within 2 standard...
-
Write an application that prompts the user for a single-digit integer and uses a loop to create the pattern shown in the example in Figure 6-32. In the example, the user entered a 3, and 10 lines are...
-
August 8, 2019, was a grim day at the San Francisco headquarters of Uber, the global leader in ride-hailing companies. That day it announced a staggering loss of $5.2 billion in just the previous 3...
-
A manufacturer of a brand of inexpensive felt-tip pens maintains a production process that produces 10,000 pens per day. In order to maintain the highest quality of this product, the manufacturer...
-
FlyFast Airways repaired one of its Boeing 767 aircraft at a cost of $600,000, which FlyFast paid in cash. FlyFast erroneously capitalized this cost as part of the cost of the plane. How will this...
-
The following control procedures over cash receipts transactions are prescribed by the David Company: 1. Restrictive endorsement of checks upon receipt. 2. Daily cash register readings and cash...
-
A car dealership needs to determine how to allocate its $20,000 advertising budget. They have estimated the expected profit from each dollar (X) spent in four different advertising media as follows:...
-
Amortization schedule with a balloon payment You want to buy a house that costs $250,000. You have $25,000for a down payment, but your credit is such that mortgage companieswill not lend you the...
-
Ziggs Corporation will pay a $4.35 per share dividend next year. The company pledges to increase its dividend by 4.75 percent per year, indefinitely. Required: If you require a 10.75 percent return...
-
Copy your question from the blogpost and paste it in the first bullet in a Word doc.Then cut and paste the relevant principles of law, supported by cases, statutes, and other authorities that you...
-
Ronald Robert has spent much of the last few years gambling and playing soccer in Chicago. He has been largely unemployed during that period. About two years ago, however, he got his act together and...
-
Denver would like your advice in relation to two property matters, one concerning 53 Cross Street and the other concerning Swettenham Cottage. 53 Cross Street Denver and his brother, Watson,...
-
An electron, initially at rest on the negative plate of a parallel plate apparatus, is accelerated through the hole of the positive plate, after which it maintains a constant speed in a uniform...
-
A physics student stands on a cliff overlooking a lake and decides to throw a golf ball to her friends in the water below. She throws the golf ball with a velocity of 22.5m/s at an angle of 32.5...
-
Does a policy of requiring that each full time employee take a one week vacation each year improve internal controls for a company and why Give at least two reasons and be specific.
-
President Lee Coone has asked you to continue planning for an integrated corporate NDAS network. Ultimately, this network will link all the offices with the Tampa head office and become the...
-
The population is aging because of a combination of declining birth rates, declining death rates, and the aging of the baby boom generation. What might be some of the implications of this demographic...
-
Describe the main forces in the global general environment that are affecting the organization.
-
List the alternatives you considered. Were they all possible alternatives? Did you unconsciously (or consciously) ignore some important alternatives?
-
The Private Securities Litigation Reform Act of 1995 and the U.S. Supreme Court's decision in Central Bank of Denver v. First Interstate Bank of Denver represent major victories in the profession's...
-
What are heuristics, and why are they of concern to auditors?
-
Identify and briefly describe the major files that are typically maintained separately from audit working papers.
Study smarter with the SolutionInn App