Please write a half page summary on the following topic: How does product liability affect IT?
In: Computer Science
why are which letters, such as A, B, C, ..., or signs, such as #, *, •, ..., are not allowed to be sent on a URL to a Web server.
In: Computer Science
//Java Language
Read an integer number from the user. If the number is not positive, change its sign.
1 Count the digits of the number
2 Count the odd digits of the number
3 Calculate the sum of the digit values of the
number
In: Computer Science
Design a class named BankAccount to hold the following data for a bank account:
Balance
Number of deposits this month
Number of withdrawals
Annual interest rate
Monthly service charges
The class should have the following methods:
Constructor:
The constructor should accept arguments for the balance and annual interest rate.
deposit:
A method that accepts an argument for the amount of the deposit. The method should add the argument to the account balance. It should also increment the variable holding the number of deposits.
withdraw:
A method that accepts an argument for the amount of the withdrawal. The method should subtract the argument from the balance. It should also increment the variable holding the number of withdrawals.
calcInterest:
A method that updates the balance by calculating the monthly interest earned by the account, and adding this interest to the balance. This is performed by the following formulas:
Monthly Interest Rate 5 (Annual Interest Rate / 12)
Monthly Interest 5 Balance * Monthly Interest Rate
Balance 5 Balance 1 Monthly Interest
monthlyProcess:
A method that subtracts the monthly service charges from the balance, calls the calcInterest method and then sets the variables that hold the number of withdrawals, number of deposits, and monthly service charges to zero.
Next, design a SavingsAccount class that extends the BankAccount class. The SavingsAccount class should have a status field to represent an active or inactive account. If the balance of a savings account falls below $25, it becomes inactive. (The status field could be a boolean variable.) No more withdrawals may be made until the balance is raised above $25, at which time the account becomes active again. The savings account class should have the following methods:
withdraw:
A method that determines whether the account is inactive before a withdrawal is made. (No withdrawal will be allowed if the account is not active.) A withdrawal is then made by calling the superclass version of the method.
deposit:
A method that determines whether the account is inactive before a deposit is made. If the account is inactive and the deposit brings the balance above $25, the account becomes active again. A deposit is then made by calling the superclass version of the method.
monthlyProcess:
Before the superclass method is called, this method checks the number of withdrawals. If the number of withdrawals for the month is more than 4, a service charge of $1 for each withdrawal above 4 is added to the superclass field that holds the monthly service charges. (Don’t forget to check the account balance after the service charge is taken. If the balance falls below $25, the account becomes inactive.)
Input
100
0.03
2.5
Where,
First line represents the balance.
Second line represents the interest rate.
Third line represents the monthly service charge.
Output
Balance: $100.00
Number of deposits: 0
Number of withdrawals: 0
Account Status: Active
Balance: $170.00
Number of deposits: 3
Number of withdrawals: 0
Account Status: Active
Balance: $20.00
Number of deposits: 3
Number of withdrawals: 2
Account Status: Incative
Balance: $17.54
Number of deposits: 0
Number of withdrawals: 0
Account Status: Incative
# Use the provided template for the demo class to fill the missing code to input data and output result as shown above. Do not change the withdraw and deposit code!
In: Computer Science
Code needed in Java
The purpose of the application is to generate some reports about
the people of the university. So a user of the application should
be able to view information about the people in the university and
generate summaries. As in implementation these are separated into
two major categories, employee and students, we will be
implementing these classes.
The system should have three classes: Person,
Employee and Student.Employees
and students are subclasses of persons and therefore, they inherit
some fields and methods from the superclass Person. What Employee
class has as an extra is a field called job which is a
String value that indicates the position of the employee at the
university. The possible values are ‘Faculty’ and ‘Staff’ and the
rest of the input should be rejected. Another significant field is
UIN (you may assume it to be an integer).Students also
have a similar structure. A field called level, gives
information regarding the student. Possible values are
‘Undergraduate’ and ‘Graduate’ and the rest of the input should be
rejected. Also A number should be implemented (you may
assume A number to be a string).
Once you create these classes write your test class with main
method.
The output of such an application would look like:
Person’s first name is Triss, last name is Merigold. She
is 25 years old.
Person’s first name is Sigismund, last name is Dijkstra. He
is 37 years old. His UIN is 793942 and serves the university as a
staff.
Person’s first name is Keira, last name is Metz. She is 19
years old. Her A-number is A021318 and she is an undergraduate
student
In: Computer Science
Using Python Programming
PROBLEM 3 - OLD MACDONALD: Write a program to print the lyrics
of the song ”Old MacDonald”. Your program should print the lyrics
using five different animals (i.e., cow, sheep, dog, cat ,turkey)
using the example verse below. For this problem you are required to
write then make use of a function getVerse that takes two string
parameters: (1) the name of an animal and (2) the sound that animal
makes. The function should not print anything if the name of the
animal is not one of the five above, or if there is a mismatch
between the animal and the sound. In your program, call your
function 5 times, passing each time to the function a different
combination of animal name and sound. The five different animals and
their associated sounds are the followings:
Animal Sound
cow moo
sheep baaa
dog woof
cat meow
turkey gobble gobble
In: Computer Science
In: Computer Science
About Cache, computer organization, computer architecture, computer science.
Cache Question:
A[0] is at memory address 0x0FED CBA0. Array B[] is right after array A[] in the data memory.
Both arrays have 10 integers
Based on memory address for A[0] of 32 bits, i know that the cache index and tag is 27 bits, offset is 4 bits and index is 1 bit.
Q: Will the tag and cache index change for A[8] and B[8]? And how will it change?
I personally feel that tag and cache index will not change for A[8]. But i'm not too sure about B[8]
Q: Does the cache behaviour affect the A[8] and B[8]?
E.g. Direct mapped cache vs 2-way set-associative cache
In: Computer Science
IN JAVA, For this exercise, you will create your own example of using a generic method. First write a program that calls a method to multiply two integers and return the integer result. Then modify that program to make the method generic, calling it with two generic data types (T1 and T2) and then returning the result in the same type (also needs to be generic). Demonstrate your program by calling the method two times, once with an integer and once with a double. In your main program, display the results of the method call showing both an integer output and a decimal output. Submit code for both your original method (non-generic) and your revised method (generic), along with execution screenshots.
In: Computer Science
2. [9 pts] Write the code necessary to properly allocate memory (on the heap) in the following scenarios
a). An array a of n characters
b) An array b of m+n integers
c) An x × y × z matrix m1 of integers initialized to 0s
Use C code
In: Computer Science
Describe the actions taken by a kernel to context-switch between processes.
In: Computer Science
/* *fix the below C Program to Display the Nodes of a Linked List in Reverse */ #include <stdio.h> #include <stdlib.h> struct node { int visited; int a; struct node *next; }; int main() { struct node *head = NULL; generate(head); printf("\nPrinting the list in linear order\n"); linear(head); printf("\nPrinting the list in reverse order\n"); display(head); delete(head); return 0; } void display(struct node *head) { struct node *temp = head, *prev = head; while (temp->visited == 0) { while (temp->next != NULL && temp->next->visited == 0) { temp = temp->next; } printf("%d ", temp->a); temp->visited = 1; temp = head; } } void linear(struct node *head) { while (head != NULL) { printf("%d ", head->a); head = head->next; } printf("\n"); } void generate(struct node **head) { int num, i; struct node *temp; printf("Enter length of list: "); scanf("%d", num); for (i = num; i > 0; i--) { temp = (struct node *)malloc(sizeof(struct node)); temp->a = i; temp->visited = 0; if (head == NULL) { head = temp; head->next = NULL; } else { temp->next = head; head = temp; } } } void delete(struct node **head) { struct node *temp; while (head != NULL) { temp = head; head = head->next; free(temp); } }
In: Computer Science
//using c fixing the error to make a correct print-out. #include <stdio.h> int main(void) { unsigned int a = 1000; signed int b = -1; if (a > b) printf("%d is more than ", a); printf("%d\n", b); else printf("%d is less or equal than ", a); printf("%d\n", b); return 0; }
In: Computer Science
Write a C program that defines
int minimum (int ji, int j2)
which returns the smaller of j1 and j2. (a) Write your program with a global variable for the actual parameter. Translate your C program to Pep/9 assembly language. (b) Write your program with a local variable for the actual parameter. Translate your C program to Pep/9 assembly language.
In: Computer Science
Convert an infix expression to its postfix representation in JAVA
In: Computer Science