Question
Change (103) to base 2 in binary number?

Question2 outputs) Wr difference, the product, the average, the distance (assuming the two entered numbers are x,y coordinates) from the origin, the maximum (the larger of the two integers), the minimum (smaller of the two integers). 2: (section 350; optional for (001/002) (18 points: 4 points for inputs, 2 points for each ite a Java program that accepts two integers from the user and then prints the sum, the Your console output should be something similar to: Input 1st integer: 31 Input 2nd integer: 39 Sum of two integers: 70 Difference of two integers: -8 Product of two integers: 1209 Average of two integers:35.00 distance 49.8196748283246 Distance of two integers: 8 Max integer: 39 Min integer: 31 Question3: (8 points) Write a Java program to break an integer into a sequence of individual digits in reverse order. (hint use the modular operation) For example: Input six non-negative digits: 987654 Expected Output: 456789 Question4: (12 points) Write a java program to remove duplicate elements from an array. Do not use Java library utilities or 3e party tools to solve this problem. You need to use the for loop and manage the index as you traverse thru the array [i ] while looking for duplicates. For example: Example 1 Original Array: 105 123 -921 -1 123 8 8 8 -921 Array with unique values: 105 123 -921 -1 8 Original Array: 10 22 120 11 Array with unique values: 22 22 11 20
Question3: (8 points) Write a Java program to break an integer into a sequence of individual digits in reverse order. (hint use the modular operation). For example: Input six non-negative digits: 987654 Expected Output 456789 Question4: (12 points) Write a java program to remove duplicate elements from an array. Do not use Java library utilities or 3rd party tools to solve this problem. You need to use the for loop and manage the index as you traverse thru the array [i ] while looking for duplicates. For example: Example 1 - Original Array: 105 123 -921 -1 123 8 8 8 -921 Array with unique values: 105 123 921 -1 8 Example 2... Original Array: 10 22 10 20 11 22 22 Array with unique values: 10 22 11 20
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. 103 in binary is 1100111

Question 3: CODE

import java.util.Scanner;

class Main {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter six non-negative digits: ");

int a = sc.nextInt();

while(a > 0)

{

System.out.print(a%10 + " ");

a = a / 10;

}

}

}

/*SAMPLE OUTPUT

Enter six non-negative digits: 987654

4 5 6 7 8 9

*/

----------------------------------------------------------------
Note: One question at a time please -- HOMEWORKLIB RULES
Please post each question at a time and let us know what is "distance" in the second question is.

Add a comment
Know the answer?
Add Answer to:
Change (103) to base 2 in binary number? Question2 outputs) Wr difference, the product, the average,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a java program to remove duplicate elements from an array. Do not use Java library...

    Write a java program to remove duplicate elements from an array. Do not use Java library utilities or 3rd party tools to solve this problem. You need to use the “for loop” and manage the index as you traverse thru the array [i ] while looking for duplicates. For example: Example 1 --------------------- Original Array: 105 123 -921 -1 123 8 8 8 -921 Array with unique values: 105 123 -921 -1 8 Example 2 --------------------------- Original Array: 10 22...

  • Write a Java program, In this project, you are going to build a max-heap using array...

    Write a Java program, In this project, you are going to build a max-heap using array representation. In particular, your program should: • Implement two methods of building a max-heap. o Using sequential insertions (its time complexity: ?(?????), by successively applying the regular add method). o Using the optimal method (its time complexity: ?(?), the “smart” way we learned in class). For both methods, your implementations need to keep track of how many swaps (swapping parent and child) are required...

  • Program 7 Arrays: building and sorting (100 points) Due: Friday, October 30 by 11:59 PM Overview...

    Program 7 Arrays: building and sorting (100 points) Due: Friday, October 30 by 11:59 PM Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be...

  • Assignment 6, Merge Arrays (java) Instructions In this assignment, you will write a program which merges...

    Assignment 6, Merge Arrays (java) Instructions In this assignment, you will write a program which merges two arrays of positive integers and removes any duplicate entries. Your program will first ask for a valid length which must be an integer which is 10 or greater. The program should continue to ask until a valid length is entered. The program will then create two arrays of the length entered, fill these with random integers between 1 and 100 inclusive, and print...

  • Need this in C Code is given below e Dots l lah dit Problem 1. (30...

    Need this in C Code is given below e Dots l lah dit Problem 1. (30 points) Fre bendord.cto obtain the free in decimal representation For ATY. this problem we complete the code in i tive long inte ens (W written the following positive long term 123, 40, 56, 7, 8, 9, 90, 900 the frequencies of all the digits are: 0:4, 1:1, 2:1, 3:1, 4:1, 5:1, 6:1, 7: 1. 8: 1.9: 3 In this example, the free ency of...

  • Assignment You will be developing a speeding ticket fee calculator. This program will ask for a t...

    Assignment You will be developing a speeding ticket fee calculator. This program will ask for a ticket file, which is produced by a central police database, and your program will output to a file or to the console depending on the command line arguments. Furthermore, your program will restrict the output to the starting and ending dates given by the user. The ticket fee is calculated using four multipliers, depending on the type of road the ticket was issued: Interstate...

  • 6174 is known as Kaprekar's constant after the Indian mathematician D. R. Kaprekar. This number is...

    6174 is known as Kaprekar's constant after the Indian mathematician D. R. Kaprekar. This number is notable for the following rule: 1. Take any four-digit number, using at least two different digits. 2. Arrange the digits in descending and then in ascending order to get two four-digit numbers, adding leading zeros if necessary. 3. Subtract the smaller number from the bigger number. 4. Go back to step 2 and repeat. The above process, known as Kaprekar's routine, will always reach...

  • Given java code is below, please use it! import java.util.Scanner; public class LA2a {      ...

    Given java code is below, please use it! import java.util.Scanner; public class LA2a {       /**    * Number of digits in a valid value sequence    */    public static final int SEQ_DIGITS = 10;       /**    * Error for an invalid sequence    * (not correct number of characters    * or not made only of digits)    */    public static final String ERR_SEQ = "Invalid sequence";       /**    * Error for...

  • The assignment : Assignment You will be developing a speeding ticket fee calculator. This program will...

    The assignment : Assignment You will be developing a speeding ticket fee calculator. This program will ask for a ticket file, which is produced by a central police database, and your program will output to a file. Furthermore, your program will restrict the output to the starting and ending dates given by the user. The ticket fee is calculated using four multipliers, depending on the type of road the ticket was issued: Interstate multiplier: 5.2252 Highway multiplier: 9.4412 Residential multiplier:...

  • hello there, i have to implement this on java processing. can someone please help me regarding...

    hello there, i have to implement this on java processing. can someone please help me regarding that? thanks War is the name of a popular children’s card game. There are many variants. After playing War with a friend for over an hour, they argue that this game must never end . However! You are convinced that it will end. As a budding computer scientist, you decide to build a simulator to find out for sure! You will implement the logic...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT