Answer:
Following are the method definition to this question:
public String notice_bill(double amount) //defining method
{
return this.name+", account number "+this.currAccNum+", please pay $"+amt; //return value.
}
Explanation:
In the given question some information is missing, that is example So, method definition to this question can be described as follows:
- In the above method definition a string method "notice_bill" is declared, which accepts a double value in its parameter, that is "amount".
- Inside the method, this keyword is used, that hold values and return its value as a message.
Answer:
See explaination
Explanation:
StackExample.java
public class StackExample<T> {
private final static int DEFAULT_CAPACITY = 100;
private int top;
private T[] stack = (T[])(new Object[DEFAULT_CAPACITY]);
/**
* Returns a reference to the element at the top of this stack.
* The element is not removed from the stack.
* atreturn element on top of stack
* atthrows EmptyCollectionException if stack is empty
*/
public T peek() throws EmptyCollectionException
{
if (isEmpty())
throw new EmptyCollectionException("stack");
return stack[top-1];
}
/**
* Returns true if this stack is empty and false otherwise.
* atreturn true if this stack is empty
*/
public boolean isEmpty()
{
return top < 0;
}
}
//please replace "at" with the at symbol
Note:
peek() method will always pick the first element from stack. While calling peek() method when stack is empty then it will throw stack underflow error. Since peek() method will always look for first element ffrom stack there is no chance for overflow of stack. So overflow error checking is not required. In above program we handled underflow error in peek() method by checking whether stack is an empty or not.
Answer:
CPU need 50% much faster
disk need 100% much faster
Explanation:
given data
workload spend time CPU = 60%
workload spend time I/O = 40%
achieve overall system speedup = 25%
to find out
How much faster does CPU need and How much faster does the disk need
solution
we apply here Amdahl’s law for the overall speed of a computer that is express as
S =
.............................1
here f is fraction of work i.e 0.6 and S is overall speed i.e 100% + 25% = 125 % and k is speed up of component
so put all value in equation 1 we get
S =
1.25 =
solve we get
k = 1.5
so we can say CPU need 50% much faster
and
when f = 0.4 and S = 125 %
put the value in equation 1
S =
1.25 =
solve we get
k = 2
so here disk need 100% much faster
#include <stdio.h>
int main(void) {
// your code goes here
//unsigned a =float_times_four(0x80000000);
unsigned float_times_four(unsigned uf){
unsigned expn = (uf >> 23) & 0xFF;
printf(expn);
unsigned sign = uf & 0x80000000;
unsigned frac = uf & 0x007FFFFF;
if(expn == 255 ||(expn == 0 && frac ==0))
return uf;
if(expn){
expn<<2;
}else if(frac == 0x007FFFFF){
//here 0x7FFFFF given by you that is wrong you place this 0x007FFFFF will excute
frac>>2;
expn<<2;
}else{
frac<<=2;
}
return (sign) | (expn <<23) | (frac);
}
return 0;
}
Answer:
Hackers frequently spend long hours examining the types and structures of targeted systems because they must use guile, or fraud to bypass the controls placed on information owned by someone else.
Explanation
The perception of a hacker has evolved over the years.
- The traditional hacker profile was a male, aged 14 to 18.
- 76% of hackers are men whose ages are between 14 years (8%) to 50 (11%). The average age is 35 years (43%).
- A hacker is persevering, patient, creative, bright and having a passion for what he does.
- Hackers today can be expert or novices.
- The experts create the software and schemes to attack computer systems.
- While the novices merely use software created by the experts.