A. Complete the method named outsideIn3(). The method has one input: a String str that is at least 3 characters long and of odd length. The output of the method is a new String where the middle character has been removed and placed both at the beginning and end.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
A. Complete the method named outsideIn3().
The method has one input: a String str that is
at least 3 characters long and of odd length.
The output of the method is a new String where
the middle character has been removed and placed
both at the beginning and end.
Examples:
outsideIn3("Cartons") returns "tCaronst" // t removed and placed at both
outsideIn3("Hip") returns "iHpi" //i removed placed at both ends.
outsideIn3("Barbara Ann") returns "rBarbaa Annr" //2ndr removed
@param str the String to process
@return a new String as described above.
*/
public String outsideIn3(String str)
// Complete the method here
* * *
Transcribed Image Text:A. Complete the method named outsideIn3(). The method has one input: a String str that is at least 3 characters long and of odd length. The output of the method is a new String where the middle character has been removed and placed both at the beginning and end. Examples: outsideIn3("Cartons") returns "tCaronst" // t removed and placed at both outsideIn3("Hip") returns "iHpi" //i removed placed at both ends. outsideIn3("Barbara Ann") returns "rBarbaa Annr" //2ndr removed @param str the String to process @return a new String as described above. */ public String outsideIn3(String str) // Complete the method here * * *
35
B. Complete the method named alarmClock();
36
You are given a day of the week,
with Sun = 0, Mon
and a boolean indicating if you are on vacation.
Your method should return a String of the form
"7:00" indicating when the alarm clock should ring.
On weekdays, the alarm should be "7:00" and on
the weekend it should be "10:00". Unless you are
on vacation-then on weekdays it should be "10:00"
and weekends it should be "off".
37
38
1, Tue = 2, ... Sat = 6,
%D
39
40
41
42
43
44
45
46
47
Examples:
alarmClock(1, false) returns "7:00"
alarmClock(5, false) returns "7:00"
alarmClock(0, false) returns "10:00"
alarmClock(0, true) returns "off"
48
49
50
51
52
@param day an int representing the day of the week.
@param onVacation is true if you are on vacation
@return the time the alarm should go off
*/
53
54
55
56
57
public String alarmClock(int day, boolean onVacation)
58
59
// Complete the method here
* *
Transcribed Image Text:35 B. Complete the method named alarmClock(); 36 You are given a day of the week, with Sun = 0, Mon and a boolean indicating if you are on vacation. Your method should return a String of the form "7:00" indicating when the alarm clock should ring. On weekdays, the alarm should be "7:00" and on the weekend it should be "10:00". Unless you are on vacation-then on weekdays it should be "10:00" and weekends it should be "off". 37 38 1, Tue = 2, ... Sat = 6, %D 39 40 41 42 43 44 45 46 47 Examples: alarmClock(1, false) returns "7:00" alarmClock(5, false) returns "7:00" alarmClock(0, false) returns "10:00" alarmClock(0, true) returns "off" 48 49 50 51 52 @param day an int representing the day of the week. @param onVacation is true if you are on vacation @return the time the alarm should go off */ 53 54 55 56 57 public String alarmClock(int day, boolean onVacation) 58 59 // Complete the method here * *
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education