Questions
IN JAVA Inheritance Using super in the constructor Using super in the method Method overriding Write...

IN JAVA

Inheritance

Using super in the constructor

Using super in the method

Method overriding

Write an application with five classes Vehicle, Car, Bus, Truck, and Tester class with main method in it.

The following characteristics should be used: make, weight, height, length, maxSpeed, numberDoors, maxPassenges, isConvertable, numberSeats, maxWeightLoad, and numberAxels.

Characteristics that are applicable to all vehicles should be instance variables in the Vehicle class. The others should be in the class(s) where they belong.

Class vehicle should have constructor that initializes all its data. Classes Car, Bus, and Truck will have constructors which will reuse their parents constructor and provide additional code for initializing their specific data.

Class Vehicle should have toString method that returns string representtion of all vehicle data. Classes Car, Bus, and Truck will override inherited toString method from class vehicle in order to provide appropriate string representation of all data for their classes which includes inherited data from Vehicle class and their own data.

Class Tester will instantiate 1-2 objects from those four classes (at least five total) and it will display the information about those objects by invoking their toString methods.

Submit one word document with code for all five classes, picture of program run from blueJ, and picture of UML diagram.

In: Computer Science

please i want solution for this question with algorithm and step by step with c++ language...

please i want solution for this question with algorithm and step by step with c++ language

  1. write a program using for loop that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed by each of the N scores and totals. Calculate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage. Sample input and output is shown below.How many exercises to input? 3

    Score received for exercise 1: 10
    Total points possible for exercise 1: 10

    Score received for exercise 2: 7
    Total points possible for exercise 2: 12

    Score received for exercise 3: 5
    Total points possible for exercise 3: 8

    Your total is 22 out of 30, or 73.33%.

In: Computer Science

list and discuss ten shortcomings of artificial neural networks

list and discuss ten shortcomings of artificial neural networks

In: Computer Science

Introduction to Algorithms - Analysis of Algorithms Solve the following recurrence relation: T(n) = T(an) +...

Introduction to Algorithms - Analysis of Algorithms

Solve the following recurrence relation: T(n) = T(an) + T((1 - a)n) + n

In: Computer Science

Which of the following is NOT available with a half adder? Sum Carry In Carry Out...

  1. Which of the following is NOT available with a half adder?
  1. Sum
  2. Carry In
  3. Carry Out
  4. None of the above

  1. For an 8x1 multiplexer, how many control signals/inputs are in need?
  1. 1    
  2. 2
  3. 3
  4. 4

  1. How many outputs are there for a decoder with 4 inputs (assuming no extra control signals/inputs)?
  1. 4
  2. 8
  3. 12
  4. 16

  1. After a logic right-shift (by one position), a given sequence 1100 1110 turns into
  1. 1100 1110
  2. 0110 0111
  3. 1110 0111
  4. 1001 1100

  1. After a logic left-shift (by two positions), a given sequence 1100 1110 turns into
  1. 1001 1100
  2. 1001 1101
  3. 0011 1000
  4. 0011 1001

  1. After an arithmetic right-shift (by one position), a given sequence 1100 1110 turns into
  1. 1100 1110
  2. 0110 0111
  3. 1110 0111
  4. 1001 1100

  1. Which of the following shifting operations may cause an overflow?
  1. Logic left-shift
  2. Logic right-shift
  3. Arithmetic left-shift
  4. Arithmetic right-shift

In: Computer Science

Complete the reading of NIST Special Publication 800-145 (2011). NIST Definition of Cloud Computing, then branch...

Complete the reading of NIST Special Publication 800-145 (2011). NIST Definition of Cloud Computing, then branch out into Internet research on how the term “Cloud Computing” has evolved and what it means now. You can talk about how cloud services are increasingly relevant to businesses today. Feel free to use an example for Infrastructure as a Service (IaaS) or Software as a Service (Saas) and talk about why companies are moving their onsite infrastructure to the cloud in many cases. Think Microsoft Azure, Amazon Web Services, Rackspace, or any number of cloud providers.

Go ahead and have a little fun with it if you like also: Pretend you are an IT manager and need to recommend a solution for moving a piece of software or hardware into the cloud. What provider would you use and why? Or would you instead recommend keeping servers/software in house?

You must post your initial response (with APA 6th ed or higher references) before being able to review other students' responses. Once you have made your first response, you will be able to reply to other students’ posts. You are expected to make a minimum of 3 responses to your fellow students' posts.

In: Computer Science

What would have to be changed in the code if the while statement were changed to:...

What would have to be changed in the code if the while statement were changed to:

while (menu == 5);

Code is as follows

 
  1. #include <stdio.h>

  2. void printHelp ()

  3. {

  4. printf ("\n");

  5. printf ("a: a(x) = x*x\n");

  6. printf ("b: b(x) = x*x*x\n");

  7. printf ("c: c(x) = x^2 + 2*x + 7\n");

  8. printf ("d: shrink(x) = x/2\n");

  9. printf ("q: quit\n");

  10. }

  11. void a(float x)

  12. {

  13. float v = x*x;

  14. printf (" a(%.2f) = %.2f^2 = %.2f\n", x, x, v);

  15. } // end function a

  16. void b(float x)

  17. {

  18. float v = x*x*x;

  19. printf (" b(%.2f) = %.2f^3 = %.2f\n", x, x, v);

  20. } // end function b

  21. void c(float x)

  22. {

  23. float v = x*x + 2*x + 7;

  24. printf (" c(%.2f) = %.2f^2 + 2*%.2f + 7 = %.2f\n",

  25. x, x, x, v);

  26. } // end function c

  27. void shrink(float x){

  28. float v = x/2;

  29. printf("shrink(%.2f) = %.2f/2 = %.2f\n", x, x, v);

  30. }//end of function shrink

  31. int menu ()

  32. {

  33. char selection;

  34. float x;

  35. printHelp ();

  36. scanf ("%s", &selection);

  37. if (selection == 'q')

  38. return 1;

  39. scanf ("%f", &x);

  40. if (selection == 'a')

  41. a(x);

  42. if (selection == 'b')

  43. b(x);

  44. if (selection == 'c')

  45. c(x);

  46. if(selection == 'd')

  47. shrink(x);

  48. return 0;

  49. } // end function menu

  50. int main()

  51. {

  52. while (menu() == 0);

  53. printf ("... bye ...\n");

  54. return 0;

  55. } // end main

In: Computer Science

Database Management Systems IT344 -Fundamentals Of Database Systems book Please Use your own words . sorry...

Database Management Systems
IT344 -Fundamentals Of Database Systems book
Please Use your own words .
sorry No handwriting
no copy paste

Construct a B+ tree for the following set of key values under the assumption that the number of key values that fit in a node is 3.

Key values (3,10,12,14,29,38,45,55,60,68,11,30)

Show the step involved in inserting each key value.


thank you for your time and effort

In: Computer Science

In JAVA answer has to be able to do exact Sample Output shown Write a do-while...

In JAVA answer has to be able to do exact Sample Output shown

Write a do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate. Name your class as NumberSum and add to it your header and sample output as a block comments. Upload the NumberSum.java file to this link.

Sample output:

Enter a number: 1
Enter another number: 2
Their sum is 3.0
Do you wish to do this again? (Y/N) y
Enter a number: 5
Enter another number: 9
Their sum is 14.0
Do you wish to do this again? (Y/N) n

In: Computer Science

A thief robbing a store can carry a maximum weight of W in their knapsack. There...

A thief robbing a store can carry a maximum weight of W in their knapsack. There are n items and ith item weighs wi and is worth vi dollars. What items should the thief take to maximize the value of what is stolen?

The thief must adhere to the 0-1 binary rule which states that only whole items can be taken. The thief is not allowed to take a fraction of an item (such as ½ of a necklace or ¼ of a diamond ring). The thief must decide to either take or leave each item.

Develop an algorithm using Java and developed in the Cloud9 environment (or your own Java IDE) environment to solve the knapsack problem.  

Your algorithms should use the following data as input.

Maximum weight (W) that can be carried by the thief is 20 pounds

There are 16 items in the store that the thief can take (n = 16). Their values and corresponding weights are defined by the following two lists.

Item Values: 10, 5, 30, 8, 12, 30, 50, 10, 2, 10, 40, 80, 100, 25, 10, 5

Item Weights: 1, 4, 6, 2, 5, 10, 8, 3, 9, 1, 4, 2, 5, 8, 9, 1

Your solution should be based upon dynamic programming principles as opposed to brute force.

The brute force approach would be to look at every possible combination of items that is less than or equal to 20 pounds. We know that the brute force approach will need to consider every possible combination of items which is 2n items or 65536.

The optimal solution is one that is less than or equal to 20 pounds of weight and one that has the highest value.   The following algorithm is a ‘brute force’ solution to the knapsack problem. This approach would certainly work but would potentially be very expensive in terms of processing time because it requires 2n (65536) iterations

The following is a brute force algorithm for solving this problem. It is based upon the idea that if you view the 16 items as digits in a binary number that can either be 1 (selected) or 0 (not selected) than there are 65,536 possible combinations. The algorithm will count from 0 to 65,535, convert this number into a binary representation and every digit that has a 1 will be an item selected for the knapsack. Keep in mind that not ALL combinations will be valid because only those that meet the other rule of a maximum weight of 20 pounds can be considered. The algorithm will then look at each valid knapsack and select the one with the greatest value.

import java.lang.*;
import java.io.*;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int a, i, k, n, b, Capacity, tempWeight, tempValue, bestValue, bestWeight;
        int remainder, nDigits;
        int Weights[] = {1, 4, 6, 2, 5, 10, 8, 3, 9, 1, 4, 2, 5, 8, 9, 1};
        int Values[] = { 10, 5, 30, 8, 12, 30, 50, 10, 2, 10, 40, 80, 100, 25, 10, 5 };
        int A[];
      
        A = new int[16];

        Capacity = 20; // Max pounds that can be carried
        n = 16; // number of items in the store
        b=0;

        tempWeight = 0;
        tempValue = 0;
        bestWeight = 0;
        bestValue = 0;

    for ( i=0; i<65536; i++) {
                remainder = i;

                // Initialize array to all 0's
                for ( a=0; a<16; a++) {
                    A[a] = 0;
                }

                // Populate binary representation of counter i
                //nDigits = Math.ceil(Math.log(i+0.0));
                nDigits = 16;

                for ( a=0; a<nDigits; a++ ) {
                    A[a] = remainder % 2;
                    remainder = remainder / 2;
                }

                // fill knapsack based upon binary representation
                for (k = 0; k < n; k++) {

                    if ( A[k] == 1) {
                        if (tempWeight + Weights[k] <= Capacity) {
                            tempWeight = tempWeight + Weights[k];
                            tempValue = tempValue + Values[k];
                        }
                    }
                }

                // if this knapsack is better than the last one, save it
                if (tempValue > bestValue) {
                    bestValue = tempValue;
                    bestWeight = tempWeight;
                    b++;
                }
                tempWeight = 0;
                tempValue = 0;
        }
        System.out.printf("Weight: %d Value %d\n", bestWeight, bestValue);
        System.out.printf("Number of valid knapsack's: %d\n", b);
    }
}

The brute force algorithm requires 65,536 iterations (216) to run and returns the output defined below. The objective of this assignment will be to develop a java algorithm designed with dynamic programming principles that reduces the number of iterations.   The brute force algorithm requires an algorithm with exponential 2n complexity where O(2n). You must create a dynamic programming algorithm using java to solve the knapsack problem. You must run your algorithm using Java and post the results.   You results must indicate the Weight of the knapsack, the value of the contents, and the number of iterations just as illustrated in the brute force output below.   You must also include a description of the Big O complexity of your algorithm.

Output from the Brute Force Algorithm.

Weight: 20
Value: 280
Number of valid knapsack's: 45

For a hint on the dynamic programming approach see the following:

The basic idea behind the dynamic programming approach: Compute the solutions to the sub-problems once and store the solutions in a table, so that they can be reused (repeatedly) later.
http://www.es.ele.tue.nl/education/5MC10/Solutions/knapsack.pdf

Some of these algorithms may take a long time to execute. If you have access to a java compiler on your local computer or the Virtual Computing Lab, you may want to test your code by running it and executing it with java directly as it can speed up the process of getting to a result. You should still execute your code within Java to get an understanding of how it executes. (To compile with java use the javac command. To run a compiled class file, use the java command)

In: Computer Science

Constructing Data Flow Diagrams: ATM Machine To start an ATM Withdrawal: • A card is inserted...

Constructing Data Flow Diagrams: ATM Machine To start an ATM Withdrawal: • A card is inserted in the slot by the user, and the PIN (personal identification number) is entered. • The ATM reads information from the card, in particular, the card number and the expiry date, and accepts the PIN from the keyboard input. • The card is verified for expiry date, and then if valid, the card number and the PIN are sent to the bank for card validation by communication circuit. • The bank either sends confirmation or refusal. If confirmation is received, the user is invited to enter a transaction type. • Assuming that the transaction is a withdrawal of cash, one more validation is performed by the bank to check that the amount nominated is below or equal to the daily limit for withdrawals of 1000 AED, that the user’s weekly withdrawals do not exceed the weekly limit of 5000 AED, and that the account balance is in credit to cover the withdrawal. • If all these are OK the card is returned, the money is dispensed, and the withdrawal receipt is printed, with the date, account number, withdrawal amount and account balance. • The bank’s account records are updated to reflect the transaction. Based on the previous scenario, create the following:

a) Create a Context diagram

b) Create level zero DFD diagram

c) Select one process from level zero and develop it into level 1 diagram.

In: Computer Science

Remarks: In all algorithm, always explain how and why they work. If not by a proof,...

Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words

Question 1: Say that we want to maintain both a Queue and a Priority Queue. This means that when you do Enqueue you also add the item to the Priority Queue and when you do Dequeue you also remove the item from the Priority Queue. And vise-versa. Show how to do it.

In: Computer Science

Three Patterns Given two numbers N and K, output three squares with the size N ×...

Three Patterns Given two numbers N and K, output three squares with the size N × N each with their own set of rules:

• The first square is made entirely using the ‘#’ symbol.

• The second square is made using the ‘.’ symbol except for every K rows use the ‘#’ symbol instead. • The third square is made using the ‘.’ symbol except for every K columns use the ‘#’ symbol instead.

Also print new line (\n) after printing each square. Look at sample input/output for more clarity.

Format Input The input consists of one line containing two numbers N and K.

Format Output The output consists of three squares with the size N × N according to the rules stated above. Don’t forget to print new line after printing each square!

Constraints

• 1 ≤ N, K ≤ 100

Sample Input 1 (standard input) :

5 2

Sample Output 1 (standard output):

#####

#####

#####

#####

#####

.....

#####

.....

#####

.....

.#.#.

.#.#.

.#.#.

.#.#.

.#.#.

Sample Input 2 (standard input):

9 3

Sample Output 2 (standard output):

#########

#########

#########

#########

#########

#########

#########

#########

#########

.........

.........

#########

.........

.........

#########

.........

.........

#########

..#..#..#

..#..#..#

..#..#..#

..#..#..#

..#..#..#

..#..#..#

..#..#..#

..#..#..#

..#..#..#

Sample Input 3 (standard input):

1 3

Sample Output 3 (standard output):

#

.

.

Note: Use long long int and c language

In: Computer Science

Using 64-bit IEEE 754 DOUBLE precision floating point with one(1) sign bit, eleven (11) exponent bits...

Using 64-bit IEEE 754 DOUBLE precision floating point with one(1) sign bit, eleven (11) exponent bits and fifty-two (52) mantissa bits, what is the decimal value of: 0xBFE4000000000000

In: Computer Science

*OBJECT ORIENTED PROGRAMMING* *JAVA PROGRAMMING* Create a program that simulates a race between several vehicles. Details...

*OBJECT ORIENTED PROGRAMMING*

*JAVA PROGRAMMING*

Create a program that simulates a race between several vehicles.

Details don't matter code must just have the following:

  • Design and implement an inheritance hierarchy that includes Vehicle as an abstract superclass and several subclasses.
    • Include a document containing a UML diagram describing your inheritance hierarchy.
  • Include at least one interface that contains at least one method that implementing classes must implement.
  • Include functionality to write the results of the race to a file; this will require Exception handling.
  • Utilize threads to ensure that all race vehicles are moving in turn.

In: Computer Science