Questions
Is there a way to limit the # of times an Excel file can be opened?...

Is there a way to limit the # of times an Excel file can be opened? The solution would also require that the Excel file could not be copied to another location to bypass the counter.

In: Computer Science

Explain how a read I/O operation happens in 2 scenarios: with DMA and without DMA. Clearly...

Explain how a read I/O operation happens in 2 scenarios: with DMA and without DMA. Clearly explain how the I/O device and the CPU works concurrently in both cases. Explain through an example showing the steps of the protocols and the algorithms underneath.

In: Computer Science

PLEASE Use the ECLIPSE... AND FOLLOW THIS RULES.. Apply the naming conventions for variables, methods, classes,...

PLEASE Use the ECLIPSE...

AND FOLLOW THIS RULES..

Apply the naming conventions for variables, methods, classes, and packages:

- variable names start with a lowercase character

- classes start with an uppercase character

- packages use only lowercase characters

methods start with a lowercase character

Write a Java application that simulates a test. The test contains at least five questions about first three lectures of this course. Each question should be a multiple-choice question with 4 options.

Design a Test class. Use programmer-defined methods to implement your solution. For example:

  • create a method to simulate the questions – simulateQuestion
  • create a method to check the answer – checkAnswer
  • create a method to display a random message for the user – generateMessage
  • create a method to interact with the user - inputAnswer

For each question:

  • If the user finds the right answer, display a random congratulatory message (“Excellent!”,”Good!”,”Keep up the good work!”, or “Nice work!”).
  • If the user responds incorrectly, display an appropriate message and the correct answer (“No. Please try again”, “Wrong. Try once more”, “Don't give up!”, “No. Keep trying..”).
  • Use random-number generation to choose a number from 1 to 4 that will be used to select an appropriate response to each answer.
  • Use a switch statement to issue the responses, as in the following code:

switch ( randomObject.nextInt( 4 ) )

{

case 0:

return( "Very good!" );

……

}

At the end of the test display the number of correct and incorrect answers, and the percentage of the correct answers.

Your main class will simply create a Test object and start the test by calling input answer method.

Thank you.

In: Computer Science

Algorithm. We divide each of the matrices A and B into 9 submatrices with size n/3...

Algorithm. We divide each of the matrices A and B into 9 submatrices with size n/3 × n/3 each. The matrix C = A × B is obtained by using 25 multiplications and 30 additions of the submatrices. What is the recursive formula of the running time function T(n) of this algorithm? What is the running time of this algorithm (in Θ notation)?

In: Computer Science

System.out.println("Enter a temperature in Fahrenheit: ");          double fahrenheit = input.nextDouble();       double...

System.out.println("Enter a temperature in Fahrenheit: ");
     
   double fahrenheit = input.nextDouble();
  
   double celsius = (5.0 / 9) * (fahrenheit - 32);
   System.out.println("Fahrenheit " + fahrenheit + " is " + celsius + " in Celsius");

the above code i would like to print to 2 decimal places for celsius please  

this is in JAVA

In: Computer Science

in Java, I need to create an array of animals. The user is going to be...

in Java, I need to create an array of animals. The user is going to be prompted to enter the size of the array where a valid size is 10-30(inclusive). Then I have to populate only half of this array. I am not sure how to do that so can you please write comments explaining.

Thank you

In: Computer Science

Identify all private and shared variables in the following code snippet. What is the output of...

Identify all private and shared variables in the following code snippet. What is the output of the program (e.g. the value of res)?

// =========

int A[100];

int count;

void work(int index[])

{

float B[10];

……

}

void main(){

int res = 10;

#pragma omp parallel  

{

int index[10], i=0, IS=0;

                        work(index);

                        #pragma omp for

                        for(i=0;i<100;i++)

                        {

IS = IS + i;

                        }

#pragma omp critical

res += IS;

}

cout << res << endl;

}

View keyboard shortcuts

In: Computer Science

I want answers of the following questions My lab assingment: its a program written in netbean...

I want answers of the following questions

My lab assingment:

its a program written in netbean ide 8.2

My topic: Bank Account

Program code:

class Account{
int acc_no;
String name;
float amount;
void insert(int a,String n,float amt){
acc_no=a;
name=n;
amount=amt;
}
void deposit(float amt){
amount=amount+amt;
System.out.println(amt+" deposited");
}
void withdraw(float amt){
if(amount<amt){
System.out.println("Insufficient Balance");
}else{
amount=amount-amt;
System.out.println(amt+" withdrawn");
}
}
void checkBalance(){System.out.println("Balance is: "+amount);}
void display(){System.out.println(acc_no+" "+name+" "+amount);}
}

class TestAccount{
public static void main(String[] args){
Account a1=new Account();
a1.insert(832345,"Ali",1000);
a1.display();
a1.checkBalance();
a1.deposit(40000);
a1.checkBalance();
a1.withdraw(15000);
a1.checkBalance();
}}


Task: Each one of you was given a Lab assignment of choosing a real world object to be represented as a programming object and writing a class code for that object. You have been asked to mimic at least 3 states and 3 behaviors of that object.

Your theory assignment is to provide the detail analysis on your part while you selected and mimic that object in programing language. You are to provide brief insight and analysis you have done in each the following:

1. What was your inspiration to choose that object?

2. Which 3 states you choose and why?

3. Do all the behaviors correspond directly to your states or not?

4. What were the challenges you faced with selecting the object?

5. If you were to asked to choose another object, which object will you choose and why?

In: Computer Science

The client needs this program written in Java. Your team is tasked to create a program...

The client needs this program written in Java. Your team is tasked to create a program that converts Fahrenheit to Celsius. Fahrenheit temperature of 87.6 degrees. Convert it to Celsius, and display the temperature in both units. Your output should look similar to the following:

Fahrenheit Temperature: 87.6
Celsius Temperature: 30.88

In: Computer Science

How would you find if numbers in an array element add up to a certain sum...

How would you find if numbers in an array element add up to a certain sum so for example if my array element consists of:

INPUT: 200, 10, 50, 20

and my output asks if these elements add to:

210? YES (200+10)

260? YES (200+10+50)

30? NO

What method would you suggest to look through the elements in an array (which im going to add through a text file) and determine if these sums exist in O(n^2)?

In: Computer Science

This is my last assignment in a programming class I had to take as a prerequisite...

This is my last assignment in a programming class I had to take as a prerequisite for a database course (seems odd). The instructor has been awful and I haven't learned much of anything. I use VBA at work and just can't follow C++. I'm stuck on this assignment and have no idea what I'm doing. I'm a database guy at work, I'm not a programmer. Please help.

In C++, a program that performs the following tasks:

1.      Design a Book class that has three data members:

string title

int   pages

double price

2.      Add constructors and methods (as well as method parameters when necessary):

Book()         // constructor(s)

getBookInfo()   // print title, pages, price

setPrice()     // change price

3.      In the main() function, create two Book objects:

b1("C++ Programming", 834, 93.53)

b2("Data Structures", 217, 64.42)

4.      Change the price of b2 to 55.46 using the setPrice() method.

5.     Using cout, Print out book information using the getBookInfo() method as shown below:

C++ Programming 834 93.53

Data Structures 217 55.46

IN C++, a program that performs the following tasks:

1.      Derive a TextBook class (child) from the Book class (parent).

2.      Add new data members:

string school

double discount

3.      Add new constructors and methods (as well as method parameters when necessary):

TextBook()           // constructor(s)

compTextBookPrice()  // price = price - discount

4.      Override inherited methods:

getBookInfo()        // print title, pages, price, school, discount

5.      In the main() function, create two Book objects and two TextBook objects:

b1("C++ Programming", 834, 93.53)

b2("Data Structures", 217, 64.42)

tb1("Database", 365, 74.41, "YSU", 20.00)

tb2("Networks", 522, 92.58, "YSU", 20.00)

6.      Using cout, print out book information as shown below:

C++ Programming  834  93.53

Data Structures  217  64.42

Database         365  54.41 YSU 20.00

Networks         522  72.58 YSU 20.00

In: Computer Science

4.4-4.6 The term arithmetic overflow refers to the condition where the result of some computation is...

4.4-4.6 The term arithmetic overflow refers to the condition where the result of some computation is
outside the range of expected results. When a computation produces a result with absolute value
smaller then the computer can represent we have arithmetic underflow.
Answer the following 4 point questions regarding the detection of incorrect computations when processing ALU instructions.


4.4 We have explored the potential for incorrect answers caused by overflow when the ALU operates
on integers. For completeness, we need to examine the possibility of underflow in integer ALU
operations. Either give an example of underflow or explain why underflow is impossible for
integer ALU computations.

4.5 Can floating point arithmetic using the IEEE standard format result in overflow? Either explain
why overflow is impossible for floating point or explain how the presence of overflow can be
detected. Note: an example can be used when giving your answer, but an example without
explanation is too poor to afford full credit.

4.6 Can floating point arithmetic using the IEEE standard format result in underflow? Either explain
why underflow is impossible for floating point computations or explain how the presence of underflow can be detected. Give an example with an explanation.

In: Computer Science

1. a) Write a C program to calculate |A-B|. You should type in A and B...

1.

a) Write a C program to calculate |A-B|. You should type in A and B when running the program.

b) Write a C program using a function to calculate (A-B)^(1/2)

-If A > B, the result will be (A-B)^(1/2)

-If A < B,the result will be (B-A)^(1/2)i

-You should type in A and B when running the program.

In: Computer Science

Peterson algorithm operating systems can someone explain to me what will be shared between the two...

Peterson algorithm operating systems can someone explain to me what will be shared between the two processes? and how is the order of execution in the two processes? if possible by drawing it will be better

i am mainly confused on how the order of execution between the two processes will be and how will the data be shared between them. i am also confused how the program counter will work between them

In: Computer Science

JAVA coding language: Consider the method getAllCharAsString: public statis String getAllCharAsString(String inputStr, char target) { }...

JAVA coding language:

Consider the method getAllCharAsString:

public statis String getAllCharAsString(String inputStr, char target) {

}

The method accepts a String parameter, inputStr, and a char parameter, target. It returns the result string consisting of all the characters in inputStr which match the target character (matching is case sensitive, for example, 'c' does not match "C"). If the characters match, the character is appended to the result String. After all the characters in inputStr have been compared, the method returns the result String. The method returns the empty String if there were no matches. Assume the inputStr is a String with length >= 0.

Example 1:

String str = "Open the pod bay doors Hal.";

String resStr = getAllCharsAsString(str, 'o');

resStr would be the String, "ooo".

Example 2:

String str = "Open the pod bay doors Hal.";

String resStr = getAllCharsAsString(str, 'z');

resStr would be the empty String, " ".

Write the getAllCharAsString method body in the box below.

In: Computer Science