Question

In: Computer Science

Part 1 - Java program named MemoryCalculator In your Ubuntu VM (virtual machine), using terminal mode...

Part 1 - Java program named MemoryCalculator

In your Ubuntu VM (virtual machine), using terminal mode ONLY, do the following:

Create the folder program2

Each record in this file represents the possible location of an error found in RAM. (Hint: One of them is not on one of the chips.)

Assume you have a computer with 4 gigs of RAM, each gig in a different memory chip, therefore you have 4 one gig RAM chips.

---------decimal---------------

HINT:

RAM chip 0 contain addresses: 0 - 8,589,934,584 bits

RAM chip 1 contain addresses: 8,589,934,585 - 17,179,869,184 bits

RAM chip 2 contain addresses: 17,179,869,185 - 25,769,803,768 bits

RAM chip 3 contain addresses: 25,769,803,769 - 34,359,738,368 bits

HINT:

RAM chip 0 contain addresses: 0 - 1,073,741,823 bytes

RAM chip 1 contain addresses: 1,073,741,824 - 2,147,483,648 bytes

RAM chip 2 contain addresses: 2,147,483,647 - 3,221,225,471 bytes

RAM chip 3 contain addresses: 3,221,225,472 - 4,294,967,296 bytes

In the same folder, in terminal mode using an editor, create a Java program to do the following:

- Call the Java program – MemoryCalculator.java

- Open the RAMerrors file

- Read each record

- Print the RAM memory chip where the error is located for each record


*** CREATE YOUR OWN METHODS THAT WILL CONVERT

HEX TO BINARY AND BINARY TO DECIMAL

*** DO NOT USE JAVA'S AUTOMATIC CONVERSION METHODS


Part 2 - Linux Shell Scripting

- Create a sh file named: program2.sh

- Set the permissions for this this *.sh file using this command to make it executable: chmod 755 program2.sh

- program2.sh should add your name and the current date and time to a NEW file called results.txt -program2.sh should then do the following:

How: - Ask the user to enter a number.

- Verify that the number is between 1 and 50, inclusive.

- If the number is not between 1 and 50, then keep asking the user to enter a number until it is valid.

- Use a loop from 1 to the value entered by the user

- Sum the results of all the included numbers, but do not include any output yet.

- After the loop ends, display the sum and append it to the results.txt file on a new line as follows

Sum of numbers is xxx

The results.txt file should have 3 lines in it when done.

***** Primarily need help with the java program *****

Solutions

Expert Solution

part 1 java program namory calculator

part 2 linux shell scripting

  • The user name and present date with time are inserted into a file.

    Initially user need enter the number, if that number is not between 1 and 50, the user need to enter it again.
    Script keeps on asking the user to enter the number if the number is not between 1 and 50.

    if the number is between 1 and 50, then all the included numbers sum is calculated. The same sum inserted into the file.

    Script is:

    #!/bin/bash

    ###WELCOME#####

    #Storing name and date in variables

    name="Mike"

    date=$(date)

    #inserting name and date variables into results.txt file

    echo "Name: $name" > results.txt

    echo "Date:$date" >> results.txt

    #ASking the user to enter a number

    echo -n "Enter numnber : "

    read n

    #checking for the between 1 and 50

    while [[ $n -le 1 || $n -ge 51 ]]

    do

    #uf number is not between 1 and 50, asking the user to enter the number again

    echo -n "Enter numnber between 1-50 : "

    read n

    done

    #calculating the sum of n numbers

    sum=0

    for (( i=1; i<=$n; i++ ))

    do

    sum=$(( $sum + $i ))

    done

    #printing the sum to the screen

    echo "Sum of numbers is $sum"

    #inserting sum results to the file

    echo "Sum of numbers is $sum" >> results.txt

    Screenshot:


Related Solutions

Using jGRASP, write a Java program named LastnameFirstname10.java, using your last name and your first name,...
Using jGRASP, write a Java program named LastnameFirstname10.java, using your last name and your first name, that does the following: Create two arrays that will hold related information. You can choose any information to store, but here are some examples: an array that holds a person's name and an array that hold's their phone number an array that holds a pet's name and an array that holds what type of animal that pet is an array that holds a student's...
Using jGRASP, write a Java program named LastnameFirstname09.java, using your last name and your first name,...
Using jGRASP, write a Java program named LastnameFirstname09.java, using your last name and your first name, that does the following: Declare an array reference variable called myFavoriteSnacks for an array of String type. Create the array so that it is able to hold 10 elements - no more, no less. Fill the array by having each array element contain a string stating one of your favorite foods/snacks. Note: Only write the name of the snack, NO numbers (i.e. Do not...
RSA: Public and Private Key Encryption im doing this on an ubuntu virtual machine but unsure...
RSA: Public and Private Key Encryption im doing this on an ubuntu virtual machine but unsure how to Create your public and private keys and create and encrypted message using python Then encrypt the message with your private key I need output of a Message you sent (in plain text and encrypted) Message you received (in plain text and encrypted)
RSA: Public and Private Key Encryption im doing this on an ubuntu virtual machine but unsure...
RSA: Public and Private Key Encryption im doing this on an ubuntu virtual machine but unsure how to Create your public and private keys and create and encrypted message using python Then encrypt the message with your private key I need output of a Message you sent (in plain text and encrypted) Message you received (in plain text and encrypted)
Using Java, write a program named MyAngles that will prompt the user for the measure of...
Using Java, write a program named MyAngles that will prompt the user for the measure of the three sides of a triangle and then reports the measurement of each interior angle of the triangle and the area of the triangle.
explain the architecture of java virtual machine with suitable diagrams.
explain the architecture of java virtual machine with suitable diagrams.
Using Eclipse IDE Create a Java Program/Class named MonthNames that will display the Month names using...
Using Eclipse IDE Create a Java Program/Class named MonthNames that will display the Month names using an array. 1. Create an array of string named MONTHS and assign it the values "January" through "December". All 12 months need to be in the array with the first element being "January", then "February", etc. 2. Using a loop, prompt me to enter an int variable of 1-12 to display the Month of the Year. Once you have the value, the program needs...
Using a (GUI interface), write a Java program that simulates an ATM machine with the following...
Using a (GUI interface), write a Java program that simulates an ATM machine with the following options menu: "Welcome" 1. Deposit to account 2. Withdraw 3. Exit
Java program Create a public method named saveData for a class named Signal that will hold...
Java program Create a public method named saveData for a class named Signal that will hold digitized acceleration data. Signal has the following field declarations private     double timeStep;               // time between each data point     int numberOfPoints;          // number of data samples in array     double [] acceleration = new double [1000];          // acceleration data     double [] velocity = new double [1000];        // calculated velocity data     double [] displacement = new double [1000];        // calculated disp...
Write a java program using the information given Design a class named Pet, which should have...
Write a java program using the information given Design a class named Pet, which should have the following fields (i.e. instance variables):  name - The name field holds the name of a pet (a String type)  type - The type field holds the type of animal that a pet is (a String type). Example values are “Dog”, “Cat”, and “Bird”.  age - The age field holds the pet’s age (an int type) Include accessor methods (i.e. get...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT