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
guapka [62]
2 years ago
13

Write a program that performs the following tasks: Display a friendly greeting to the user Prompt the user for the value to conv

ert (a String) Accept that String Prompt the user for the value of the initial base (an integer) Accept that integer Prompt the user for the desired base of the output (an integer) Accept that integer If the String is not a legal expression of a number in the initial base, display an error message and exit the program. Convert the value represented by the String in the initial base to the desired base. Display the result.
Computers and Technology
1 answer:
andrezito [222]2 years ago
3 0

Explanation:

import java.util.Scanner;

import java.math.BigInteger;

public class Main

{

private int x;  

public static boolean isValidInteger(String theValue, int theBase)

{    

BigInteger number = new BigInteger(theValue,theBase);

if(theValue.equals(number.toString(theBase)))

{

return true;

}

else

return false;

}

public static String convertInteger(String theValue, int initialBase, int finalBase)

{

boolean valid=isValidInteger(theValue,initialBase);

if(valid==true)

{

BigInteger number = new BigInteger(theValue);

return(number.toString(finalBase));

}

else

return("String not in initial base");  

}

public static void main(String[] args)

{

System.out.println("Welcome");

String value;

int ibase, dbase;

if(args.length==0)

{

Scanner S = new Scanner(System.in);

System.out.println("Enter Value to be converted :: ");

value = S.nextLine();

System.out.println("Enter initial base :: ");

ibase = S.nextInt();

System.out.println("Enter desired base :: ");

dbase = S.nextInt();

}

else

{

value=args[0];

ibase=Integer.parseInt(args[1]);

dbase=Integer.parseInt(args[2]);

}

  System.out.println("Change base "+convertInteger(value,ibase,dbase));  

}

}

Output

You might be interested in
Which shot is not the best for a widescreen image
sasho [114]
Closeup? I think I’m pretty sure but I don’t really know though
7 0
3 years ago
Read 2 more answers
You work in a classified environment where Bell LaPadula MLS (Multilevel Security) model is employed. Your clearance is "SECRET"
kumpel [21]

Answer:

The answer is by using a covert channel like shared memory objects such as files, directories,messages, etc since both  the user and the sender of the document are on same network of the company.

Explanation:

The Bell LaPadula MultiLevel Security model was a security policy developed by Bell and LaPadula in 1973 in response to a security issue raised by the US Air Force regarding file-sharing mainframe computers . Actually, many people with networked systems have realized by early 1970s that the protection purportedly offered by many commercial operating systems was poor, and wa not getting better any time soon. This was observed when it was noticed that as one operating system error was fixed, some other vulnerability would be discovered. There was also the constant worry that various unskilled users would discover loopholes in the operating system during usage and use them to their own advantage.

 Information release may take place via shared memory objects such as files, directories, messages, and so on. Thus, a Trojan Horse acting on behalf of a user could release user-private information using legitimate operating system requests. Although developers can build various mechanisms within an operating system to restrict the activity of programs (and Trojan Horses) operating on behalf of a user  , there is no general way, short of implementing nondiscretionary policy models, to restrict the activity of such programs. Thus, given that discretionary models cannot prevent the release of sensitive information through legitimate program activity, it is not meaningful to consider how these programs might release information illicitly by using covert channels.

For example, for someone with higher integrity level (SECRET) to send an accounts payable application to a user, if the untrusted accounts payable application contains a Trojan Horse, the Trojan Horse program could send a (legal) message to the said user process running at a lower integrity level (CONFIDENTIAL), thereby initiating the use of a covert channel. In this covert channel, the Trojan Horse is the receiver of (illegal) lower integrity-level input and the user process is the sender of this input.

7 0
3 years ago
What is the definition of posture<br>​
Vinvika [58]

Answer:

The posture is how someone sits at his or her computer.

Hope this helps ;-))

6 0
3 years ago
Which OS does NOT provide users with a GUI?
vesna_86 [32]
The answer is C ms-dos
Side note:
GUI means graphical user interface. In other words, that means it looks pretty and has cool buttons, animations and cute stuff. MS-DOS is just a black screen with words on it. Definitely not cute or cool.
3 0
3 years ago
PLS HELP ASAP- Select the correct text in the passage.
SCORPION-xisa [38]

Answer:

reread the text

Explanation:

I do it it helps

5 0
2 years ago
Read 2 more answers
Other questions:
  • If you are planning to carry a large balance on your credit card, which of the following credit card features should you look fo
    7·2 answers
  • Earthquakes with magnitudes between 1.0 and 2.9 on the Richter scale are
    11·1 answer
  • Boardman College maintains two files—one for Sociology majors and another for Anthropology majors. Each file contains students'
    5·1 answer
  • A ______ is an exact duplication of the hard drive, including data files, system files, and settings, application files, and the
    15·1 answer
  • Nuclear batteries use devices called thermocouples, which convert the ____ of a nuclear reaction into electricity.
    9·1 answer
  • In an information systems framework, ________ is the bridge between the computer side on the left and the human side on the righ
    14·1 answer
  • the term that is used to describe how many bits are used in each pixel to show the number of colours used
    11·1 answer
  • You’ve just finished training an ensemble tree method for spam classification, and it is getting abnormally bad performance on y
    9·1 answer
  • Complete the following sentence.
    7·1 answer
  • Which statements are true? Select 4 options.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!