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
Suppose that you have the following definitions:
spin [16.1K]

Suppose that you have the following definitions:struct time Type struct tourTypen the variable destination of type your type are tourType input(){cout<<"Enter the city, distance and time in hr and min"<>destination.city name;

<h3>What is C++ statements?</h3>

Expression statements. These statements examine an expression for its aspect outcomes or for its go-back value. Null statements. These statements may be supplied in which a declaration is needed with the aid of using the C++ syntax however in which no motion is to be taken.

  1. #include
  2. #include
  3. the use of namespace std;
  4. struct timeType
  5. ;
  6. struct tourType
  7. ;
  8. tourType destination;
  9. tourType input(){
  10. cout<<"Enter the city, distance and time in hr and min"<>destination.cityName;
  11. cin>>destination.distance;
  12. cin>>destination.travelTime.hr;
  13. cin>>destination.travelTime.min;
  14. go back destination;
  15. }
  16. void display()cityName;
  17. d.distance = t->distance;
  18. d.travelTime.hr = t->travelTime.hr;
  19. d.travelTime.min = t->travelTime.min;">
  20. int main().

Read more about the variable :

brainly.com/question/2804470

#SPJ1

6 0
1 year ago
How does theatre compare with movies or television? What makes it similar to movies and television? What makes it different?
givi [52]

Answer:

you cant mess up in theatre but you can redo scences in movies, thay both have acting in them

Explanation:

im a theatre person

3 0
3 years ago
"running computer programs and their data are stored in ___"
Lesechka [4]

Solution:

Running computer programs and their data are stored in Rom.

ROM is "built-in" computer memory containing data that normally can only be read, not written to. ROM contains the programming that allows your computer to be "booted up" or regenerated each time you turn it on. Unlike a computer's random access memory (RAM), the data in ROM is not lost when the computer power is turned off. The ROM is sustained by a small long-life battery in your computer.

5 0
3 years ago
Read 2 more answers
The range of an area where users can access the Internet via high frequency radio signals transmitting an Internet signal from a
Alexandra [31]
A) hotspot
Bluetooth is for short distance and pan is Personal area networks (PANs) connect an individual's personal devices
8 0
3 years ago
Read 2 more answers
1. Describe how research and development influence design. Cite specific examples of how research and development influence desi
vladimir1956 [14]

Answer:

so i research and found this,

Development is when findings of a research are utilized for the production of specific products including materials, systems and methods. Design and development of prototypes and processes are also part of this area. Engineering is utilization of these plans and research to produce commercial products.

4 0
2 years ago
Other questions:
  • Fill in the blank. Do not abbreviate.
    6·1 answer
  • Which of the following menu commands would you select to make a copy of an open file and rename it?
    15·1 answer
  • Which key is used in word processors to create indentations?
    13·2 answers
  • In Web design, What kind of tag is referred to as fixed ?<br>​
    7·1 answer
  • Kyle asked his supervisor which type of computing model was used when the enterprise first started. She explained that the organ
    14·1 answer
  • Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue acce
    9·1 answer
  • The breastbone or ________________ extends down the chest.
    5·1 answer
  • Who innovated an aeroplane? ​
    5·1 answer
  • Does anybody know how to get this little search bar thing off of my task bar on a HP laptop.
    12·1 answer
  • Instructions
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!