Questions
Suppose I have a 32 bit register containing 0000AC12 in hex and I do a logical...

Suppose I have a 32 bit register containing 0000AC12 in hex and I do a logical shift >>2. What hex digits will result from the binary shift? Be sure to show all 32 bits in hex

In: Computer Science

Write a Java program that reads words from a text file and displays all the non-duplicate...

Write a Java program that reads words from a text file and displays all the non-duplicate words in ascending order. The text file is passed as a command-line argument.

Command line argument: test2001.txt

Correct output:

Words in ascending order...

1mango

Salami

apple

banana

boat

zebra

In: Computer Science

Compare and contrast traditional (e.g. waterfall) and iterative software development models.

  1. Compare and contrast traditional (e.g. waterfall) and iterative software development models.

In: Computer Science

Write a program that will write the contents of a text file backwards one character at...

Write a program that will write the contents of a text file backwards one character at a time. Your program should first ask for the text file name to be processed – and after verifying that the file exists, it should read the file into a StringBuilder buffer. Save the new file using the old filename appended with “Ver2-“ at the front. So for the file “MyStuff.txt” the file would be saved as Ver2-MyStuff.txt”. You can use any text file to test your work.

In: Computer Science

What kind of information can a hacker get from a good packet sniffer program? How could...

What kind of information can a hacker get from a good packet sniffer program?

How could packet sniffing be used in a good way or positive benefits?

In: Computer Science

I have a python program that must check if an integer is the sum of the...

I have a python program that must check if an integer is the sum of the squares of four consecutive prime numbers. However, when I run the program, it goes into an infinite while loop, and it doesn't give me any answer. I can only use the while, if, else, True and False commands. The code I'm using is

n1=2

  n2=3

  n3=5

  n4=7

  n = int(input("n: "))

  if (n==(n1**2)+(n2**2)+(n3**2)+(n4**2)):

    print(n1,n2,n3,n4)

  else :

    i = 2

    pr = True

    next = n4 + 2

    while next <= n:

      while i < next and pr == True:

        if next%i == 0:

          pr = False

        else :

          pr = True

        i=i+1

      if pr == True:

        n1 = n2

        n2 = n3

        n3 = n4

        n4 = next

        if (n==(n1**2)+(n2**2)+(n3**2)+(n4**2)):

          print(n1,n2,n3,n4)

        else:

          next = next + 2

    if (next>n):

      print("false")

And it only works with the number 87, since it's outside the while loop

In: Computer Science

................................................ ................................................ This programming lab assignment requires that you create a class and use an equals...

................................................

................................................

This programming lab assignment requires that you create a class and use an equals method to compare two or more objects. Your should use your QC5 as a reference.

…………………………...……..

…………………………...…….

Instructions

LAB5 Instructions

Using QC5 as a model, create a Rectangle class and a CompareUsingequalsMethod class that uses an   equals Method to determine if two rectangles are equal if and only if their areas are equal. The Rectangle class should have two instance variables length and width.

Your submission to BB should be your “Rectangle.java” and “CompareUsingequalsMethod.java” files only, not included in a .zip file or a .gpj file.

..............................................................

.............................................................

QC5

Circle.java

/**circle class*/
public class Circle{
//fields
private int radius;
//constructor
public Circle(int radius){
this.radius = radius;
  
}
//methods
public int getRadius() {
return radius;
}
public boolean equals(Circle inC1, Circle inC2){
if(inC1.getRadius() == inC2.getRadius())
return true;
else
return false;
  
}
}

…………………………………………….

…………………………………………………………..

CompareUsingequalsMethod.java

/**Demos using the equals method*/
public class CompareUsingequalsMethod{
public static void main(String[] args){
Circle circle1 = new Circle(3);
Circle circle2 = new Circle(3);
Circle circle3 = new Circle(5);
if (circle1.equals(circle1,circle2)) {
System.out.println(" Circle1 with radius " + circle1.getRadius() +
" is equal to circle2 with radius " + circle2.getRadius());

}
else{
System.out.println(" circle1 with radius " + circle1.getRadius() + " Radius is not equal to circle2 with radius " + circle2.getRadius());
  
}
if(circle3.equals(circle3,circle2)) {
System.out.println(" Circle3 with radius" + circle3.getRadius() +
" is equal to circle2 with radius" + circle2.getRadius());
}
else{
System.out.println(" circle3 with radius " + circle3.getRadius() + " Radius is not equal to circle2 with radius " + circle2.getRadius());
  

}
}
}

In: Computer Science

I am stuck on this Java problem: Create an Animal class with: Attributes Age Rabies Vaccination...

I am stuck on this Java problem:

Create an Animal class with:

  • Attributes
    • Age
    • Rabies Vaccination Status
    • Name
    • Owner Name
  • A constructor to set values
  • Getters and Setters for all private attributes
  • A toString method that gives the data of all attributes

Create a Dog Class

  • Attributes
    • Distemper Vaccination Status
  • A constructor to set values in sub class
  • A constructor to set values in sub and super class
  • Getters and Setters for private attributes
  • A toString method that overrides the super class and adds Distemper Vaccination Status
  • A speak method that outputs "bark".

Create a Cat Class

  • Attributes
    • Feline Leukemia Vaccination Status
    • Declawed Status
  • A constructor to set values in sub class
  • A constructor to set values in sub and super class
  • Getters and Setters for private attributes
  • A toString method that overrides the super class and adds Feline Leukemia Vaccination Status
  • A speak method that outputs "Meow".

In: Computer Science

Lab 2 ∑={0,1} L = {w : if |w| is odd w begins with 11}. List...

Lab 2

∑={0,1} L = {w : if |w| is odd w begins with 11}.

List the indistinguishability classes for L(M). Include the following information for each class c, where wc is a string in c:

• A short description or characteristic function that describes the strings in c.

• Whether wc is or is not in L(M).

• ∀z(wcz ∈ L(M) iff … ). This rule must be different for each equivalence class — that is what makes them different classes.

• The class transitions for each symbol in Σ: wca ∈ [na] and Σ: wcb ∈ [nb], where na and nb are the numbers of equivalence classes.

In: Computer Science

Implement a python program in file named tarvel.py. Create an empty dictionary named responses. Implement while...

Implement a python program in file named tarvel.py. Create an empty dictionary named responses. Implement while loop to take in user's name and desired destination for as long as there are user inputs. Prompt user to input yes to continue and no to quit. Prompt for user's name. Receive the name into the program and save it as the value of name variable. Prompt user for their desired vacation destination. Receive response and save it as the value of a response variable. Send the name and response to your response dictionary as key-value pair. Once all inputs are in the program, print each poll participant's name and desired vacation destination. Use for loop to run through all key-pairs in the dictionary. Pay attention to your output. Print the dictionary to show the key-value pairs. Test program with 3 - 5 key value pairs.

In: Computer Science

Use Java GUI to write a chessboard 8 Queens Problem Write a program that can place...

Use Java GUI to write a chessboard

8 Queens Problem

Write a program that can place 8 queens in such a manner on an 8 x 8 chessboard that no queens attack each other by being in the same row, column or diagonal.

In: Computer Science

Please use java language in an easy way with comments! Expand your below program, so it...

Please use java language in an easy way with comments!

Expand your below program, so it can include cursed items (weapons that break, armor that causes more damage when worn). In order to do that, write an interface called "CursedItem". Then create subclasses of the armor, and weapon class that implement the CursedItem interface :

CursedWeapon: using a random number generator, there is a 4 in 10 chance that the weapon breaks during combat.

CursedArmor: this item amplifies the damage taken in battle instead of reducing it.

The interface only needs to have one method. In your driver class, create an example object for each of the new classes.

-----------------------------------------------------------------------------------------------------------

//Java code

public class GameItem {
    protected String itemName; //Name of the item

    //constructor

    public GameItem(String itemName) {
        this.itemName = itemName;
    }

    //use()
    public void use();
}

//======================================

/**
 * Weapon class that extends the GameItem class
 */
public class Weapon extends GameItem {
  
    private int damage;

    //constructor

    public Weapon(String itemName, int damage) {
        super(itemName);
        this.damage = damage;
    }

    public void use() {
        System.out.println("You now wield "+itemName+". This weapon does "+damage+" points of damage with each hit.");
    }
}

//==========================================

/**
 *  Armor class that extends the GameItem class
 */
public class Armor extends GameItem{
 
    private double protection;

    public Armor(String itemName, double protection) {
        super(itemName);
        this.protection = protection;
    }

    @Override
    public void use() {
        System.out.println("You have equipped "+itemName+". This item reduces the damage you take in combat by "+protection+" percent.");
    }
}

//=====================================

import java.util.ArrayList;

public class GameItemTest {
    public static void main(String[] args)
    {
        ArrayList<GameItem> inventory = new ArrayList<>();
        inventory.add(new Weapon("Sword",50));
        inventory.add(new Armor("Shield",85.9));

        for (GameItem g:inventory ) {
            g.use();
        }
    }
}

In: Computer Science

Solving Problems Using Recursion (Python): To solve the problem, you have to use recursion and cannot...

Solving Problems Using Recursion (Python):

To solve the problem, you have to use recursion and cannot use for or while loops to solve the problems as well as not using global variables.

1. Create a function that takes a positive integer and returns it with neighboring digits removed. Do not convert the integer to a list.

Ex.

Input = [5555537777721]

Output = [53721]

In: Computer Science

determine the impulse response and the step response of the following causal systems plot the pole-zero...

determine the impulse response and the step response of the following causal systems plot the pole-zero patterns and determine which are stable

y(n) = 3/4y(n - 1)- 1/8y(n - 2) + x(n)

In: Computer Science

Write a tester program to test the mobile class defined below. Create the class named with...

Write a tester program to test the mobile class defined below.

Create the class named with your id (for example: Id12345678) with the main method.

  1. Create two mobiles M1 and M2 using the first constructor.
  2. Print the characteristics of M1 and M2.
  3. Create one mobile M3 using the second constructor.
  4. Change the id and brand of the mobile M3. Print the id of M3.

Your answer should include a screenshot of the output. Otherwise, you will be marked zero for this question.

public class Mobile {

private int id;

private String brand;

public Mobile() {

    id = 0;

    brand = "";

}

public Mobile(int n, String name) {

    id = n;

    brand = name;

}

public void setBrand(String w) {

    brand = w;

}

public void setId(int w) {

    id = w;

}

Public int getId() {

In: Computer Science