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
vovikov84 [41]
3 years ago
12

20 pts, please write in JAVA. need this ASAP

Computers and Technology
1 answer:
Katen [24]3 years ago
5 0

public class JavaApplication78 {

   public boolean findChar(String string, String key){

       if (string.contains(key)){

           return true;

       }

      return false;

   }

   public static void main(String[] args) {

       JavaApplication78 java = new JavaApplication78();

       System.out.println(java.findChar("hello", "h"));

   }

   

}

First I created the findChar method using the contains method. It checks to see if a certain sequence of characters is in another string. We returned the result. In our main method, we had to create a new instance of our main class so we could call our findChar method.

You might be interested in
What happens when you use diff to compare two binary files that are not identical? (You can use gzip to create the binary files.
Hunter-Best [27]

Answer:

When there's a comparison between binary files with diff, there's a message from the utility that says there's a difference when the files differ or there's no message when the two are same. ASCII files comparison is made by the diff utility line-by-line. there's no provision to make comparisons on a byte by byte basis. in that case use cmp.

Explanation:

5 0
3 years ago
Task 2: Typing a School Speech
strojnjashka [21]

This is my school put you can change it up:

It has elementary and high school divisions. Wister Elementary School is a public school located in Wister, OK. It has 333 students in grades PK, K-8 with a student-teacher ratio of 14 to 1. According to state test scores, 14% of students are at least proficient in math and 23% in reading.

7 0
3 years ago
Two names of computers used during each generation of computer.
monitta
Http://www.webopedia.com/DidYouKnow/Hardware_Software/FiveGenerations.asp
3 0
3 years ago
Create a new Java application called "AverageCalculator" (without the quotation marks) that prompts the user with three separate
k0ka [10]
<h2>Answer:</h2>

//import the Scanner class

import java.util.Scanner;

public class AverageCalculator {

   public static void main(String[] args) {

       //Create an object of the Scanner class to allow for user's input

       Scanner input = new Scanner(System.in);

       

       //Create first prompt for the user to enter the first number

       System.out.println("Please enter the first number");

       

       //Use the Scanner object input, to receive the first number

       //And store in a double variable called fnum

       double fnum = input.nextDouble();

       

       //Create second prompt for the user to enter the second number

       System.out.println("Please enter the second number");

       

       //Use the Scanner object input, to receive the second number

       //And store in a double variable called snum

       double snum = input.nextDouble();

       

       //Create third prompt for the user to enter the third number

       System.out.println("Please enter the third number");

       

       //Use the Scanner object input, to receive the third number

       //And store in a double variable called tnum

       double tnum = input.nextDouble();

       

       //Declare a variable of type double, called avg, to hold the average of the three numbers

       double avg;

       

       //Now find the average of the three numbers,

       // and store the result of the average in the avg variable declared above

       avg = (fnum + snum + tnum) / 3;

               

       //Print out the result with explanatory text while you convert

       //all numbers to 2 decimal places by using the String.format() method.

       //The String.format() method takes in two arguments - the format descriptor and  

       //the number to be transformed.

       //First argument : In this case, the format descriptor is %.2f

       //Where the % sign signifies that the string (%.2f) is a format specifier.

       //The .2 specifies 2 decimal places. It means, you would use .3 if you wanted the number in 3 decimal places.

       //The f signifies that the number in question is a floating-point number.

       //Second argument : specifies the floating-point number to be transformed.        

       System.out.println("The average of the numbers " + String.format("%.2f", fnum) + ", " + String.format("%.2f", snum) + ", and " + String.format("%.2f", tnum) + " is " + String.format("%.2f", avg));

   

}      //End of main method

   

}   // End of class declaration

<h2>Sample output:</h2><h2>---------------------------------------------------------------</h2>

>> Please enter the first number

30

>> Please enter the second number

100

>> Please enter the third number

21

>> The average of the numbers 30.00, 100.00, and 21.00 is 50.33

<h2>---------------------------------------------------------------</h2>

<h2>Explanation:</h2>

The code above has been written in Java and it contains comments explaining every segment of the code. Please go through the comments carefully for more understanding.

<h2>Code without comments:</h2><h2 />

import java.util.Scanner;

public class AverageCalculator {

   public static void main(String[] args) {  

       Scanner input = new Scanner(System.in);

       System.out.println("Please enter the first number");

       double fnum = input.nextDouble();

       System.out.println("Please enter the second number");

       double snum = input.nextDouble();

     

       System.out.println("Please enter the third number");        

       double tnum = input.nextDouble();

     

       double avg;

       avg = (fnum + snum + tnum) / 3;

               

       System.out.println("The average of the numbers " + String.format("%.2f", fnum) + ", " + String.format("%.2f", snum) + ", and " + String.format("%.2f", tnum) + " is " + String.format("%.2f", avg));

   

}  

   

}

4 0
3 years ago
People, materials, tools, machines, and time are examples of mainly being outputs.
andriy [413]
False, they are inputs
8 0
3 years ago
Read 2 more answers
Other questions:
  • The _______ dialog box displays formatting tabs for Font, Number, and Alignment
    9·1 answer
  • There is a simple method for constructing a magic square for any odd value of n:
    15·1 answer
  • Assume that a text box named PhoneNumberTextBox appears on a form and contains the phone number 414-555-5555. What value will di
    5·1 answer
  • These operating systems were referred to as command-based.
    12·1 answer
  • In order to manage information for a company, your website would need a/an
    6·1 answer
  • Why does Microsoft release new versions of its Windows operating system every few years?
    9·2 answers
  • Fill in the blanks using A to J below.
    9·1 answer
  • Most sources consider the ARPA-NET project the birth of computer blank<br> .
    11·2 answers
  • Convert 10101010 into decimal number system​
    13·2 answers
  • In the bussiness cycle which term best fits the labeled point on the graph
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!