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
Moving your Sprite top to bottom is moving along the X coordinate?
Marianna [84]
The answer is false
6 0
3 years ago
Consider the classes below, declared in the same file: class A { int a; public A() { ​ a = 7; } } class B extends A { int b; pub
DiKsa [7]

Answer:

2. <em>A reference of type A can be treated as a reference of type B</em> - False

Base class or its objects are not related to their derived class (or its objects).

Explanation:

class A {

   int a;

   public A() {

       a = 7;

   }

}

class B extends A {

   int b;

   public B() {

       b = 8;

   }

}

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

1. <em>After the constructor for class B executes, the variable a will have the value 7 </em>- True.

When an object of a derived class is declared, the constructor of base class is called before the constructor of derived class (is called).

3. <em>Both variables a and b are instance variables </em>- True.

Classes can have instance, or member, variables and methods.

4.<em> After the constructor for class B executes, the variable b will have the value 8</em> - True.

When object of class B is declared, its constructor was called, which initialized variable b to 8.

4 0
3 years ago
What tool is used to find and organize files on a mac
Margaret [11]

Answer:

the tool is literally called <u><em>The Finder.</em></u>

Explanation:

hope this helps

4 0
2 years ago
What is e-governence?What are the advantage of it.​
kondaur [170]

Answer:

The advantages of e-government include an improved flow of information from citizen to government, government to citizen, and within government itself. Additionally, e-government helps modernize administration procedures, improving economies and promoting transparency in the process.

E-government is the use of technological communications devices, such as computers and the Internet, to provide public services to citizens and other persons in a country or region.

5 0
2 years ago
Isabel and Jared work for the same company but in different departments. Their workstations are both part of the company's compu
Nina [5.8K]

Network access limitations implemented from their local IT Department

3 0
3 years ago
Read 2 more answers
Other questions:
  • What does the group on option do?
    10·1 answer
  • Where should you look to find contact information about a company? I. on the company website II. at your local library III. in t
    11·2 answers
  • Which is a benefit of owning a desktop computer instead of a laptop?
    13·2 answers
  • Describe how data center storage applications drive the development of SAN technology.
    8·1 answer
  • In Java
    6·1 answer
  • What is the role of science and technology in achieving human’s ultimate goal or the good life?
    8·2 answers
  • Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in byt
    5·1 answer
  • Write a method that takes two circles, and returns the sum of the areas of the circles.
    10·1 answer
  • What are some positive and nevative aspects of technology?
    11·1 answer
  • List four tasks that humans perform frequently, but which may be difficult for a computerized agent to accomplish. Describe the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!