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
svetlana [45]
4 years ago
9

Write an expression to detect that the first character of userinput matches firstLetter. 1 import java.util.Scanner; 3 public cl

ass CharMatching 4 public static void main (String [] args) { Scanner scnr new Scanner(System.in); String userInput; char firstLetter; userInput = scnr.nextLine(); firstLetter scnr.nextLine().charAt (0); 12 13 14 15 if (/* Your solution goes here * System.out.printin( "Found match: "firstLetter); else t System.out.println("No match: " firstLetter); 17 18 19 20 21 return

Computers and Technology
2 answers:
mote1985 [20]4 years ago
8 0

Answer:

The code to this question as follows:

Code:

if(userInput.charAt(0)==firstLetter) // if block

{

//statements

}

else //else block

{

//statements.

}

Explanation:

The description of the above code as follows:

  • In the program, we use two variables for user input that is "userInput and firstLetter". The datatype of the userInput is a string that is used to insert any value from the user. Then we use the firstLetter variable the datatype of the variable is char because it is used to detect first character. To detect this we define the conditional statement.
  • In the if block we check condition that userInput first index value is equal to firstLetter it will print "Found match: value".
  • In else block if the value does not match it will print "No match: value".  
mixas84 [53]4 years ago
5 0

Answer:

if(Character.toUpperCase(firstLetter)==Character.toUpperCase(userInput.charAt(0)))

Explanation:

You might be interested in
My monitor is a 60hz, and i overclocked it to 80hz. The max it will go is to 85hz, but i left it at 80hz. Will it damage my moni
Angelina_Jolie [31]

Answer:

No, It will not. but sometimes when you do the overclock the monitor may not have fast enough pixel response time. you might notice some tearing in the image. but will not do any permit damage

Explanation:

my display is overclocked from 60hz to 75hz (the max)

6 0
3 years ago
Before u can open and edit a file, you need to zip it, T/F
koban [17]

Answer

False, it is not necessary that you need to zip a file always when you are opening and editing a file

<u><em>PLS MARK BRAINLIEST</em></u>

5 0
3 years ago
Python’s pow function returns the result of raising a number to a given power. Define a function expo that performs this task, a
weeeeeb [17]

Answer:

The function is as follows:

def expo(num,n):

   prod= 1

   for i in range(n):

       prod*=num

       

   return prod

<em>The big-O notation is: O(n)</em>

Explanation:

This defines the function

def expo(num,n):

This initialzes the product to 1

   prod= 1

This iteration is perfomed n times

   for i in range(n):

The number is multiplied by itself n times

       prod*=num

       

This returns the calculated power

   return prod

To calculate the complexity.

The loop is repeated n times.

Each operation has a complexity O(1).

So, in for n number of operations; the complexity is: O(n * 1)

This gives: O(n)

5 0
3 years ago
Which of the following situtaions demonstrates informatiomal technology used as a primary focus
Studentka2010 [4]

Answer:

well if your spesific then I could tell you

6 0
4 years ago
Write a function called starts_with(prefix, wordlist) that takes as inputs a string prefix and a list of strings wordlist, and t
Anvisha [2.4K]

Answer:

Hi there! The question can easily be implemented by iterating through the array list an using the "startswith()" function of the String class. Please find explanation below.

Explanation:

We can write the code as below into a file called starts_with.py and run it from the command line. Sample input is also provided with results.

starts_with.py

import sys;

def starts_with(prefix, wordlist):

   for e in wordlist:

       if e.lower().startswith(prefix.lower()):

           starts_with_array.append(e);

starts_with_array = [];

prefix = input("Enter prefix: ");

wordlist = input("Enter word list: ");

wordlist = wordlist.split(',');

starts_with(prefix, wordlist);

print(starts_with_array);

Usage with Result

> starts_with.py

> Enter prefix: Fun

> Enter word list: Funtastic,Fun,Test,No

> ['Funtastic', 'Fun']

3 0
3 years ago
Other questions:
  • Write a program that requests a state abbreviation as input and displays the justices appointed from that state. The justices sh
    6·1 answer
  • Why would it be beneficial to preview a page before printing?
    8·1 answer
  • In Web design, What kind of tag is referred to as fixed ?<br>​
    7·1 answer
  • A technician wants to consolidate and log specific alerts from network devices into a database so maintenance tasks and potentia
    11·1 answer
  • A direct-mapped cache holds 64KB of useful data (not including tag or control bits). Assuming that the block size is 32-byte and
    14·1 answer
  • You can use a minus sign to make a negative numberlike -2. What happens to each of the following 2++2
    8·1 answer
  • define the term computer hardware and its various types mentioning 5 examples of IP or devices with one diagram each​
    9·1 answer
  • What kind of eolr would you need to not have a open trouble on the facp
    12·1 answer
  • Explain Importance of flowchart in computer programming
    7·1 answer
  • The Internet Protocol Suite consists of the Internet Protocol and _____. a. Transmission Control Protocol b. File Transfer Proto
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!