Please please return it to me in 30 minutes!!! Thank you so much!!!
Learning Objectives Writing methods Using string methods Using if statements The Widget Class
The inchesToFeet Method
1. Create a new BlueJ project called Lab 3: (Project > New Project... ). In your
new project, create a class called Widget using the New Class button. 2. Clean out the starting scaffolding that BlueJ provides, leaving the class
documentation. Update that comment accordingly. Make sure you put your PID in
the @author tag. 3. In the Widget class, create a method called inchesToFeet in your class that
accepts a single int parameter representing a distance in inches and returns
a double. Write code in the method that computes and returns the equivalent
distance in feet. For example, if the parameter to the method is 66, the method
should return 5.5. 4. Add a JavaDoc comment above the method describing the purpose of the
method. Include an @param tag describing the parameter and an @return tag
describing the returned value. 5. Compile the Widget class and fix any errors. Then right click on the class in the
BlueJ project window and select new Widget() to create a Widget object. A red box
representing the object should appear in the bottom of the project window. 6. Now right click the object and select the inchesToFeet method to execute it. In
the window that appears, fill in a value for the parameter and press OK. Verify that
the correct value is returned in response. 7. Modify the code of the inchesToFeet method, adding an if statement so that if
the value passed to the method is negative, the method returns 0. Otherwise, the
method should return the computed feet as originally written. Make sure the
indentation of each statement is appropriate. 8. Test the method with a various parameter values to raise your confidence that
the method works as intended. The computeArea Method
1. In the Widget class, write a method called computeArea that accepts
two double parameters representing the length and width of a rectangle and
returns a double representing the rectangle's area. 2. 3. Create a new Widget object in the BlueJ project window and
test the computeArea method. For example, if the parameters are 3.7 and 2.88,
the returned value should be 10.656. Test it a few times with various parameter
Add an appropriate JavaDoc comment above the computeArea method. The warpWord Method
1. Write another method called warpWord that accepts a String parameter
representing a word and returns a String result. 2. The method should return a string that is composed of the same characters as
the parameter, all in uppercase letters, and with all occurrences of the letter 'A'
replaced by the letter 'X'. For example, if the parameter passed to the method is
"Atlanta", the returned string should be "XTLXNTX". Use
the toUpperCase and replace methods of the String class to accomplish this. 3. Test the warpWord method as you did the other methods. When you fill in the
parameter value, remember to put double quotes around the word. Add
appropriate documentation to the method. The checkWordLength Method
1. Add one more method to the Widget class called checkWordLength that
accepts a String parameter, but doesn't return anything (use a return type of void).
The method should use an if statement to see if the word is more than 8 characters
long and print an appropriate message either way. For example, if the parameter is
"book", then the method should print
book is not a long word and if the parameter is "splendiforous" the method should print
splendiforous is a long word 2. Note the difference between returning a value and printing output! The purpose
of the checkWordLength method is to print output. The warpWord method
returns a string and doesn't print anything. 3. Add an appropriate JavaDoc comment above the checkwordLength method
after you've tested it.
This question was answered on: Dec 18, 2020
Buy this answer for only: $15
This attachment is locked
We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)
Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
About this QuestionSTATUS
Dec 18, 2020EXPERT
GET INSTANT HELP
We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.
You can also use these solutions:
- As a reference for in-depth understanding of the subject.
- As a source of ideas / reasoning for your own research (if properly referenced)
- For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).