Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

1.

a. What lines are in the scope of the variable i declared at line 16? b. What lines are in the scope of the variable k declared at line 7? c. What lines are in the scope of the variable k declared at line 26? d. Provide a trace table for this program. What is the final output? Keep in mind the scopes of the variables while making your trace table. How many columns will it need? (Trace the program first, then type it into Eclipse to verify your answer).

2. Write a method that takes a String as input and returns the reverse of that String. Then write a second method that uses the first method to test whether or not an input String is a palindrome. Your method should return true if the String is a palindrome, and false otherwise. Palindromes were discussed in Exercise 2 of Closed Lab 06, and you should use the same definition here. In addition, write a main method that tests your method with a variety of Strings that should return true and false values.

3. Using the methods you wrote for the above question, write a method that takes a Scanner as an input parameter and returns a String as a result. The method should print a prompt to the screen asking the user to enter a palindrome. It should then test the input. If it is not a palindrome, it should print an error message and continue asking for a palindrome until the user provides one. Once a palindrome has been input, the method should return it. In addition, write a main method that uses this method and displays the final palindrome to the screen.

4. Write a method named rowOfStars that takes a single integer parameter n and returns a String with that many stars in it. For example, calling the method with a value of 3 would cause the String "***" to be returned.

5. Using the method you wrote for the previous question, write a method that takes a single integer parameter n and prints a triangle of stars to the screen that has a height and base size equal to n. For example, calling the method with a value of 4 will produce the triangle:

*

**

***

Java, Programming

  • Category:- Java
  • Reference No.:- M92399222
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As