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
5(x + 4) = 4(x -6) |<br><br><br>How to do this problem
vichka [17]
5 ( x + 4 ) = 4 ( x - 6)
5x + 20 = 4x - 24
5x -4x + 20= 4x - 4x - 24
1x + 20 = -24
1x + 20 - 20 = -24 - 20
1x = -44

check

5 (-44 + 4) = 4 ( -44 - 6)
5 (-40) = 4 (-50)
-200 = -200
3 0
3 years ago
Nina is trying to learn more about how computers work. She has repeatedly read that the motherboard is the "brain” of the comput
Lady bird [3.3K]

Its

Processes the data on the computer .

5 0
2 years ago
Read 2 more answers
How do I write a good personal narrative pls help im struggling very hard rn.​
statuscvo [17]

Answer: Find out which starter makes your partner most interested in reading your story.

1. Start with action or dialogue.

2. Ask a question or set of questions.

3. Describe the setting so readers can imagine it.

4. Give background information that will interest readers.

5. Introduce yourself to readers in a surprising way.

Explanation:

4 0
3 years ago
"in program arrays12.java a swap method is called. does the swap method exchange parameter values x and y?"
horrorfan [7]
<h2>Yes the swap method exchange parameter values if passed by reference or the value gets changed inside the function.</h2>

Explanation:

Since the program is not given, I will try to guide you about the mode of parameters.

The meaning of swap is interchanging the values. It can be done by using temporary variable or without using it (if the values are integers).

While passing the parameters, there are two ways, call by value/pass by value and call by reference/ pass by reference.

If call by value, then the value gets swapped only inside the function and will not reflected in the calling portion. Call by reference is other way round.

6 0
3 years ago
How many possible password of length four to eight symbols can be formed using English alphabets both upper and lower case (A-Z
Fynjy0 [20]

Answer:

In a password, symbol/characters can be repeated. first calculate the total

symbols which can be used in a password.

So there are total 26(A-Z),26(a-z),10(0-9) and 2(_,$) symbols.

that is equal to 26+26+10+2=64.

Total number of password of length 4:

here at each place can filled in total number of symbols i.e 64 way for each

place.Then total number of possible password is:

64*64*64*64=16777216

Total number of password of length 5:

here at each place can filled in total number of symbols i.e 64 way for each

place.Then total number of possible password is:

64*64*64*64*64=1073741824

Similarly,

Total number of password of length 6:

64*64*64*64*64*64=68719476736

Total number of password of length 7:

64*64*64*64*64*64*64=4398046511104

Total number of password of length 8:

64*64*64*64*64*64*64=281474976710656

Hence the total number of password possible is:285,942,833,217,536

7 0
3 years ago
Other questions:
  • Test if a password entered is correct. The secret phrase is Ada Lovelace. Sample Run 1 Enter the Password: Ada Lovelace Sample O
    13·1 answer
  • Need Help ASAP!
    14·2 answers
  • )a___ is a complete binary tree such that each node in the tree contains a comparable object that us greater than or equal to th
    9·1 answer
  • A nonpipelined system takes 300ns to process a task. The same task can be processed in a 5-segment pipeline with a clock cycle o
    10·1 answer
  • What is a GUI?
    11·1 answer
  • After fixing the format of her subheadings, she notices that she misspelled the name of one of the famous people
    7·2 answers
  • Which scenarios are examples of students managing their time well? Check all that apply. A student studies while watching her fa
    8·2 answers
  • Write a program that repeatedly reads in integers until a negative integer is read. The program keeps track of the largest integ
    9·1 answer
  • The action of entering data into your computer. This can be text typed in a word processing document, keywords entered in a sear
    8·1 answer
  • A Chain of dry-cleaning outlets wants to improve its operations by using data from devices at individual locations to make real-
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!