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
Ostrovityanka [42]
2 years ago
8

This program needs to be written in Java. Along with NO For/while loops, and no methods.

Computers and Technology
1 answer:
Umnica [9.8K]2 years ago
6 0
The only way without a while loop and no method I can think of is use switch with every possible variation of the four digit binary which is 15.

Here is the starter code:

import java.util.Scanner;
public class MyClass {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int digit = sc.nextInt();
switch(digit) {
case 0000:
System.out.println("0");
break;
case 0001:
System.out.println("1");
break;
case 0010:
System.out.println("2");
break;
case 0011:
System.out.println("3");
break;
case 0100:
System.out.println("4");
break;

… (fill in other cases)


}
}
}

Use this link: https://www.electronics-tutorials.ws/binary/bin_3.html

There might be a better way, but without loops or methods this is all I got.
You might be interested in
_____________is the act of protecting information and the systems that store and process it.A.Information systems securityB.Poli
mylen [45]

Answer:

A. Information System Security (ISS)

Explanation:

Information System security is a very important security in any organization.

The main focus of Information system security is the system itself and the information that the system possesses, processes and stores.

Information system security, or infosec for short, is the modality involved in protecting information and in making it available.

With Infosec,

1. an organization's ability to perform is protected

2. the data an organization uses is protected ensuring integrity

3. programs, applications and technology implemented on an organization's systems are safely used.

Hope this helps!

3 0
3 years ago
Read 2 more answers
Assume the Student and Employee classes each extend the Person class. The Student class overrides the getMoney method in the Per
SSSSS [86.1K]

Answer:

Person p1, p2, p3;

int m1, m2, m3;

p1 = new Person();

// assignment 1

m1 = p1.getMoney();

p2 = new Student();

// assignment 2

m2 = p2.getMoney();

p3 = new Employee();

// assignment 3

m3 = p3.getMoney();

//////////////////////////////////////////////////////////////////////////////////////////////

The reference to getMoney in assignment 3 is to the <em>Person</em> class.

Explanation:

Since Employee class didn't override Person class's getMoney() method, calling p3 with getMoney() will call Base class's (Person) getMoney() method.

6 0
3 years ago
How long would it take to leave oort cloud?
il63 [147K]
Voyager 1, is the fastest and farthest of the interplanetary space probes it is leaving the Solar System and will reach the Oort cloud in about 300 years and would take about 30,000 years to pass through it.
4 0
3 years ago
Match the following slide annimation.annimation tab.handout.notes.microsoft office button​
frez [133]
I need more information
4 0
3 years ago
Solve this for brainlest​
Tamiku [17]

Answer:

add html and then press ctrl+ y

AS IT STARTS REFRESH IT.

4 0
3 years ago
Other questions:
  • A banker would like to present a spreadsheet as part of a presentation to potential clients. The spreadsheet makes use of severa
    14·1 answer
  • Explain how can you protect your computer from malware
    15·2 answers
  • Which key removes all data from an active cell with one click? A. Esc B. Delete C. Tab D. F2
    9·2 answers
  • How does math help you determine the amount of watts a turbine produces?
    13·1 answer
  • Which protocol below is used to email clients to send email
    6·1 answer
  • What does “human-like” mean when we are talking about a machine?
    7·1 answer
  • What is the BCC feature used for?
    12·2 answers
  • Carl is a music teacher. He builds custom computer systems for his students to use when they are learning and creating music. Ca
    8·1 answer
  • Why is it important to follow a consistent naming convention for variables?
    7·1 answer
  • While a remote assistance session is in progress, what keyboard key(s) can the requestor press to terminate the connection?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!