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
Why are the keys on the qwerty keyboard arranged the way they are?
sveticcg [70]
Sholes arranged the keys in their odd fashion to prevent jamming on mechanical typewriters by separating commonly used letter combinations.
7 0
2 years ago
With modeling and simulation, we model the system and then test the ______________ to gather test predictions.
Kobotan [32]

Answer:

With modeling and simulation, we model the system and then test the system to gather test predictions.

Explanation:

You would have to test the system in order to see if it's working right and everything is all good with the system.

I hope this helped. I am sorry if you get this wrong.

4 0
2 years ago
Which range of values would result in 10 elements stored in an array?
Paraphin [41]

Answer:

0-9

Explanation:

count 0 as 1

len(0,1,2,3,4,5,6,7,8,9)=10

3 0
3 years ago
Most networking media send data using _____ in which data is represented by only two discrete states: 0s and 1s.
dlinn [17]

Answer:

i think digital signals

Explanation:

A digital signal is a signal that is being used to represent data as a sequence of discrete values; at any given time it can only take on one of a finite number of values.[1][2][3] This contrasts with an analog signal, which represents continuous values; at any given time it represents a real number within a continuous range of values.

6 0
3 years ago
Read 2 more answers
Which wireless technology connects with most mobile devices?
LenaWriter [7]

Answer:

¡) Internet

¡¡) Alexa

¡¡¡) Electronic Devices

8 0
1 year ago
Other questions:
  • True or False? A supervisory control and data acquisition (SCADA) device is a computer that controls motors, valves, and other d
    13·1 answer
  • Please help!
    6·2 answers
  • 10.Find the first ICMP Echo Request message that was sent by your computer after you changed the Packet Size in pingplotter to b
    8·1 answer
  • Walking paths across the part is represented by the equation why equals -4x - 6​
    9·1 answer
  • The protocol that enables computers on the Internet to communicate with one another is called _____.
    10·2 answers
  • Write a function chat accepts a pointer to a C-string as its argument. The function should count the number of vowels appearing
    5·1 answer
  • Interest accumulated on the principle of a loan must also be paid. The accumulated interest is known as which of the following?
    7·1 answer
  • What is output? Select all that apply. c = 0 while (c < 10): c = c + 5 print (c) 0 1 2 3 4 5 6 7 8 9 10
    10·1 answer
  • Java question
    15·1 answer
  • Where to store <br> ammunition
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!