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
Which of the following best explains how the Internet is a fault-tolerant system?
IrinaK [193]

Answer:

A

Explanation:

The Internet is fault-tolerant because cybercriminals can conceal their actions, allowing them the ability to carry out faulty actions without leaving a trace.

This statement is actually the same question I had to answer when in my 2nd year 1st semester in itt.
<3 enjoy

8 0
2 years ago
Read 2 more answers
What is an analog computer?<br>​
tigry1 [53]

Answer:

It is a computer that is used to process analog data.

7 0
3 years ago
Read 2 more answers
What tool allows you to search external competitive intelligence research?
enot [183]

Answer:

SocialPeta

Explanation:

4 0
2 years ago
When I try to add a module into a device, Packet Tracer pop-ups a warning message saying "Cannot add a module when the power is
laiz [17]

plug it into a charger the go to I tunes and it should be there


4 0
3 years ago
Setting up network encryption involves
fiasKO [112]
A or B cuz you need one of the two to have WiFi cuz my computer asks if i have an adapter and then SSID
7 0
3 years ago
Other questions:
  • Which of the following should be the first page of a report?
    11·1 answer
  • A tablet computer transmits a file over a wi-fi link to an access point.
    13·1 answer
  • Help what is a computer made from (computer class question)!!
    9·1 answer
  • Please Do Solve it guys...
    6·1 answer
  • Java can be used to create which of the following technologies?This task contains the radio buttons and checkboxes for options.
    5·1 answer
  • How do you change the name on your brainly account?
    12·1 answer
  • Compute (110110001.01)2 + (27.12)10 + (121.25)16 – (130.20)16 and display the answer in hexadecimal base.
    7·1 answer
  • While your hands are on home row, your left hand rests lightly on _____.
    13·2 answers
  • What is lasso tool write the name of any modelling and animation software<br>​
    8·1 answer
  • How many hours do you spend on the Internet per day?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!