1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
andrew-mc [135]
4 years ago
15

JAVA In this exercise, you are given a phrase that starts with ‘A'. If the word after ‘A' begins with a vowel, add an ‘n' after

the ‘A', otherwise, return the phrase as is. Example: grammer("A word") --> "A word" grammer("A excellent word") --> "An excellent word" public String grammar(String phrase) { }
Computers and Technology
1 answer:
stiks02 [169]4 years ago
4 0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

   

 System.out.println(grammar("A excellent word"));

}

public static String grammar(String phrase) {

    if (phrase.charAt(2) == 'a' || phrase.charAt(2) == 'e' || phrase.charAt(2) == 'i' || phrase.charAt(2) == 'o' || phrase.charAt(2) == 'u')

        return "An" + phrase.substring(1);

    else

        return phrase;

}

}

Explanation:

Create a function called grammar that takes one string parameter, phrase

Check if the character after "A", is one of the vowels, using charAt function. If it is, then insert "n" after "A". (To insert "n", concatenate two parts: "An", and the substring of the initial string after A).

Otherwise, return the initial string

You might be interested in
Jane is a full-time student on a somewhat limited budget, taking online classes, and she loves to play the latest video games. S
Maslowich

Answer:

A workstation with 3.9Ghz of processor with 16-GB of RAM and 24" inch monitor

Explanation:

above option is selected is because latest video games require such requirements .on other hand these are normal system specifications nowadays.

7 0
3 years ago
What is the full form of bcc please tell​
expeople1 [14]

Blind Carbon Copy

For emails. It is used to send a copy of the email to somebody without the original person receiving it knowing that you sent a copy.

3 0
3 years ago
Read 2 more answers
Write the function longest that, given a nonempty list of strings, finds the longest even-length string that ends with ing. It t
lorasvet [3.4K]

Answer:

  1. def longest(L):
  2.    for x in L:
  3.        if(len(x) % 2 == 0):
  4.            if(x.endswith("ing")):
  5.                return x  
  6.    return ""
  7. print(longest(["Playing", "Gaming", "Studying"]))

Explanation:

The solution is written in Python 3.

Firstly, create a function longest that takes one parameter L as required by question (Line 1).

In the function, create a for loop to traverse through each string in L and check if the current string length is even (Line 2 - 3). If so, use string endwiths method to check is the current string ended with "ing". If so return the string (Line 4-5).

At last, test the function by passing a list of string and we shall get the output "Gaming".

8 0
3 years ago
Your teacher needs to keep track of a biology experiment's results for all students, to help calculate the grades. Which applica
IRISSAK [1]

Answer:

I think notepad is best suited for this task...

3 0
4 years ago
Read 2 more answers
The OnStar system allows Select one: a. a vehicle owner to initiate a conversation with an OnStar representative. b. the vehicle
Rzqust [24]

Answer:  e) a, b, and c

Explanation: OnStar system is the secondary service that is provided by the General Motor Corporation , who is the parent company of this system.The services like in-vehicle protection, diagnosing issues from distance emergency services, communication services based on subscriptions, turn by turn navigation etc.

Conversation started with OnStar member by vehicle owner is communication service in hands -free way, vehicle sending message to OnStar member after mishap/accident is type of emergency services and OnStar member putting off the gas pedal without the permission of driver of the the vehicle is also a protect service .Thus, all the given options are correct.

6 0
3 years ago
Other questions:
  • The cmos memory located on the motherboard is often referred to as _____ memory because of its capability to store bios settings
    9·1 answer
  • I’m stuck in a class where i don’t understand anything, it’s only been 3 days.. any tips for learning computer coding?
    12·1 answer
  • Which of the following is considered both an input and output peripheral?
    10·1 answer
  • What is the statement describing? Agile team continuously adapt to new circumstances and enhance the methods of value delivery
    6·1 answer
  • How do i cancle my account on brainly
    11·1 answer
  • Which of the following is an electronic device, operating under the control of instructions stored in its own memory, that can a
    6·1 answer
  • James would like to send a document he has saved on the hard drive to coworkers in Ireland, Brazil, and India. These coworkers h
    6·2 answers
  • 5.9.5 Fibonacci <br><br> Y’all I’m struggling here do any of you have the code?
    12·1 answer
  • What type of email communication reaches out to former clients and older prospects and encourages a reply? Strategic email Onboa
    5·1 answer
  • Which of the following file formats allows you to share and save documents
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!