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
algol [13]
3 years ago
14

Write a JAVA program containing a method called hasEight(), which takes an int as input and returns true if the number contains

the digit 8 (e.g., 18, 808). Your program must implement the method and take input from the user. Please upload only your .java file for full credit. Any other file type and programs without the hasEight() method will not receive any credit.
Computers and Technology
1 answer:
skelet666 [1.2K]3 years ago
7 0

Here's my code for that, consider it under the WTFPL (http://www.wtfpl.net/). Here is a pastebin of the code, as to avoid text formatting. (Link: https://pastebin.com/S3BDGxqm Raw: https://pastebin.com/raw/S3BDGxqm)

package javaapplication6;

import java.util.Scanner;

public class JavaApplication6 {

   

   public static void main(String[] args) {

       

       Scanner myScanner = new Scanner(System.in);

       

       boolean a;

       int s;

       System.out.println("Enter an int");

       s = myScanner.nextInt();

       a = hasEight(s);

       System.out.println(a);

       

   }

   private static boolean hasEight(int s)

   {

       String str = String.valueOf(s);

       return str.contains("8");

   }

   

}

You might be interested in
Who does Potholes effect in South Africa?
Morgarella [4.7K]
By definition, a pothole is a structure mostly located at the surface of roads and highways wherein it is usually characterised by having deep crevices which are primarily caused by extreme soil erosion or the presence of water in the area. In addition, these potholes greatly affect the transportation system of South Africa because the flow of traffic will be interrupted.
4 0
3 years ago
Digital art is created by using
enyata [817]

Answer:

D. Computers

Explanation:

Digital art is when you make art on electronic devices.

8 0
3 years ago
What is a type of machine-to-human communication?
suter [353]
I don’t know what it’s called but it’s where they can speak by moving there eyes
3 0
3 years ago
Why would Network Systems employees be employed by the government?
Ghella [55]
Well knowing how the government is with security id go with A. as it makes a lot of sense unlike B and D and if they were looking for software the question would mention it
8 0
3 years ago
Read 2 more answers
Pleeeese help me for these questions
geniusboy [140]

1 Account

2 online

3 access

4 password

5 internet

6 email

4 0
3 years ago
Other questions:
  • Upgrading only the motherboard will give some performance improvement to a computer system. Why would the improvement be limited
    14·1 answer
  • In Word, blue underlining indicates which of these problems?
    12·1 answer
  • How do you reduce computer screen flicker
    11·1 answer
  • Which of these is a requirement for developing game applications on devices running Apple’s iOS operating system?
    6·2 answers
  • Natalie is a secretary and must complete a large amount of filing this afternoon. At 1:00 PM, the office receptionist gets sick
    10·1 answer
  • Suppose testcircle1 and circle1 in listing 9.1 are in two separate files named testcircle1.java and circle1.java, respectively.
    14·1 answer
  • 6. According to camp policy, staff members need to be at least 23 years old to transport students. Dean now wants to determine h
    9·1 answer
  • What is said to be the first mechanical calculator​
    7·2 answers
  • Which term describes a visual object such as a picture a table or text box
    15·2 answers
  • Design an algorithm to find the weighted average of four test scores. The four test scores and their respective weights are give
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!