2. Will the following statements cause any error? (Yes/No) If a statement causes an error, what type of errors it is? (logic error, syntax/compile error, or runtime error). Again, there is no need to do the java code and test in jGrasp. You don’t need to provide the error message from the compiling or running results. The types of the error will be enough.
a. byte temp = 850;
b. celsius = 5 / 9 * (fahrenheit – 32);
c. int x = 3 / 0;
d. int y = 7 / 3.0;
e. int z = (int) 2.34567;
f. int value = 2147483647 + 1;
In: Computer Science
Part I– Check your file system
Step 1: Execute the ls /dev/sd* command to see the current hard disk devices.
Step 2. Execute the fdisk -l command to list the current hard disk partitions
Step 3. Execute the parted -l command to list the current hard disk partition table.
Part II– Create a new virtual disk
Step 1. In the Oracle VM VirtualBox Manager program, create a new virtual hard disk with the size of 200 MB, and name it as “your_name.vdi” (for example, jbondsvdi).
Step 2. Load this virtual hard disk to your virtual machine.
Step 3. Repeat the steps in Part I, and highlight the differences
Part III– Creating Partitions and Filesystems
Step 1. Use the fdisk command to create a new primary partition on the new hard disk.
Step 2. Use the correct command to create an ext4 filesystem on the new partition.
Step 3. Repeat the steps in Part I, and highlight the differences
Step 4. Make a new directory named /cyse. And mount the new partition under this directory.
Step 5. Use the df command to check the mounting point of the new partition.
Step 6. Create a new file named file1.txt in the directory /cyse and put your name in that file
Step 7. Unmount /cyse directory.
Step 8. Check the contents in /cyse directory. What do you find?
In: Computer Science
import java.util.Scanner;
import java.util.Arrays;
/*
You have 3 small methods to write for this exam;
public static int smallest(int[] v1, int[] v2)
public static int[] convert1(String str)
public static String convert2(int[] v)
The comments right before each of them tell you exactly what they
are
expected to do. Read all requirements first, then start
implementing
the easiest methods first. You may work on them in any order.
You are also provided with a main method and two other methods
that
are just there to call the methods your wrote with a bunch of
tests
and display the outcomes of these tests on the console to help you
debug
them.
Please note that the tests we provide you with are not
exhaustive.
Your methods still need to meet all requirements even if we
did
not provide you with a test for that particular requirement.
if you want to add more tests, I recommend you modify the main
method.
If you are comfortable with the code in the two testing
methods,
you may also modify them instead but do not waste too much time
working
on them.
Good luck!
*/
public class COP2513E1{
/**
This method returns 1 if vector v1 is the "smallest", 2 if it is
vector v2,
or 0 otherwise.
We define "smallest" as follows;
If one of the vector has fewer elements than the other, it is the
smallest one.
If both are the same size, then we look at every element one by one
in order.
As soon as one of the two vectors has an element that is < than
the corresponding
element from the other vector, then it is recognized as the
"smallest" one by our method.
**/
public static int smallest(int[] v1, int[] v2){
return 0; // always returns 0 for now, replace this with your
code
}// end method smallest
/**
This method takes a string that is guaranteed to be made only
of digits, without spaces or anything else.
Examples; "123" or "0"
Your goal is to create a new array of int values that will
hold
each of the digits specified in the String.
Example; if the string passed is "123" your returned array
should contain the int value 1 at index 0, the value 2 at index
1,
and the value 3 at index 2.
Once you are done, return the reference to your newly created
array of int values.
**/
public static int[] convert1(String str){
return new int[1]; // always returns an array with 1 element for
now, replace this with your code
}// end method convert1
/**
This method does the opposite work of the above convert1
method.
It takes a vector of single-digit int values and return a
string
with all these digits one after the other.
If one of the values in the vector is not in the range 0 to 9
inclusive,
then simply have this method return an empty string as result
instead.
**/
public static String convert2(int[] v){
return ""; // always returns an empty string for now, replace this
with your code
}// end method convert2
/*
Do not modify the main, or the other methods below this line,
except if you want to add more tests
*/
//=========================================================================
public static void main(String[] args){
testSmallest();
testConvert();
}// end main method
public static void testSmallest(){
System.out.println("Testing your method smallest(...)");
int[][] testVectors1 = {
{1,2,3},
{1,2,3,4},
{1,2,3},
{1,2,3},
{2,3,4}
};
int [][] testVectors2 = {
{1,2,3,4},
{1,2,3},
{1,2,3},
{2,3,4},
{1,2,3}
};
int [] expectedOutcomes = {
1, 2, 0, 1, 2
};
if((expectedOutcomes.length != testVectors2.length)
||(expectedOutcomes.length != testVectors1.length)
||(testVectors1.length != testVectors2.length)){
System.out.println("All tables must have the same # of
tests");
System.exit(-1);
}// end if
int nTests = expectedOutcomes.length;
for(int test=0; test < nTests ; test++){
int observedOutcome = smallest(testVectors1[test],
testVectors2[test]);
System.out.print("\tTest #" + test + " with vectors "
+ Arrays.toString(testVectors1[test]) + " and " +
Arrays.toString(testVectors2[test]));
if(observedOutcome == expectedOutcomes[test])
System.out.println(" SUCCEEDED");
else
System.out.println(" FAILED");
}// end for loop
} // end testSmallest method
public static void testConvert(){
String[] strings= {
"",
"0",
"9",
"12",
"123"
};
int[][] vectors = {
{},
{0},
{9},
{1,2},
{1,2,3}
};
System.out.println("\nTesting your method convert1(...)");
if(vectors.length != strings.length){
System.out.println("All tables must have the same # of
tests");
System.exit(-1);
}// end if
for(int test=0 ; test < strings.length ; test++){
int[] observed = convert1(strings[test]);
System.out.print("\tTest #" + test + " with string \"" +
strings[test] + "\"");
System.out.println(" "+ (Arrays.equals(observed,
vectors[test])?"SUCCEEDED":"FAILED"));
}//end for loop
System.out.println("\nTesting your method convert2(...)");
for(int test=0 ; test < vectors.length ; test++){
String observed = convert2(vectors[test]);
System.out.print("\tTest #" + test + " with vector " +
Arrays.toString(vectors[test]));
System.out.println(" "+
(observed.equals(strings[test])?"SUCCEEDED":"FAILED"));
}//end for loop
}// end testConvert method
} // end class
In: Computer Science
[The following
information applies to the questions displayed
below.]
At the beginning of the year, Plummer's Sports Center bought three used fitness machines from Brunswick Corporation. The machines immediately were overhauled, installed, and started operating. The machines were different; therefore, each had to be recorded separately in the accounts.
Machine A | Machine B | Machine C | ||||
Invoice price paid for asset | $ | 32,300 | $ | 32,300 | $ | 23,400 |
Installation costs | 2,300 | 2,400 | 1,100 | |||
Renovation costs prior to use | 4,000 | 1,000 | 1,900 | |||
By the end of the first year, each machine had been operating 6,500
hours.
2. Prepare the entry to record depreciation expense at the end of Year 1, assuming the following. (If no entry is required for a transaction/event, select "No journal entry required" in the first account field.)
ESTIMATES |
|||||
Machine | Life | Residual Value | Depreciation Method | ||
A | 9 years | $1,700 | Straight-line | ||
B | 64,000 hours | 3,700 | Units-of-production | ||
C | 8 years | 1,500 | Double-declining-balance |
In: Finance
In sql: Write a query to produce a listing of unique vendor names who have at least one invoice with us. You are using a table view called COMPANY_INFORMATION that lists a vendor id, vendor name, term id, and term description. The second table you will reference is the invoice table that lists vendor id, invoice num, invoice number, and invoice total. Do not show duplicate results.
In: Computer Science
A compound of molecular formula C7H13Br is a tertiary bromide, is optically inactive, and has one primary carbon atom. C7H13Br is inert to catalytic hydrogenation. C7H13Br is reacted with another unknown compound. Thin-layer chromatography of the product mixture shows that two products are formed. GC analysis shows that the two products are formed in unequal amounts. Upon isolation from each other via distillation, both isolated products are optically inactive. Both products de-colorize molecular bromine.
Answer questions a-c below.
a. Based on the information provided, is the reaction between the tertiary bromide and the unknown compound a: 1. substitution, or 2. elimination reaction? ________
b. Will the organic starting material give a positive (P) or negative (N) result for the silver nitrate in alcohol test? ________
c. Propose a structure for C7H13Br. Name the structure.
In: Chemistry
Universal Technologies, Inc. has identified two qualified vendors with the capability to supply some of its electronic components. For the coming year, Universal has estimated its volume requirements for these components and obtained price-break schedules from each vendor. (These are summarized as “all-units” discounts in the table below.) Universal’s engineers have also estimated each vendor’s maximum capacity for producing these components, based on available information about equipment in use and labor policies in effect. Finally, because of its limited history with Vendor A, Universal has adopted a policy that permits no more than 60% of its total unit purchases on these components to come from Vendor A.
Vendor A |
Vendor B |
||||||||
Product |
Requirement |
Unit price |
Volume required |
Unit price |
Volume required |
||||
1 |
500 |
$225 |
0–250 |
$224 |
0–300 |
||||
$220 |
250–500 |
$214 |
300–500 |
||||||
2 |
1000 |
$124 |
0–600 |
$120 |
0–1000 |
||||
$115 |
600–1000 |
(no discount) |
|||||||
3 |
2500 |
$60 |
0–1000 |
$54 |
0–1500 |
||||
$56* |
1000–2000 |
$52 |
1500–2500 |
||||||
$51 |
2000–2500 |
||||||||
Total capacity (units) |
2500 |
2000 |
|||||||
*For example, if 1400 units are purchased from Vendor A, they cost $56 each, for a total of $78,400.
What is the minimum-cost purchase plan for Universal?
In: Operations Management
You are driving along straight road. You cover 200 miles in 4 hours? Does that mean that your speedometer read 50 mph for your entire trip? Is is necessary that your speedometer register 50 mph at least once during the trip? Use math to explain your answer.
I understand that your speedometer would not be 50mph for the entire trip, but I am not sure how to explain it using math.
In: Civil Engineering
In MATLAB:
(a) Insert a comment in your script that says Problem 1:
(b) Below this comment, generate a vector of values called x that starts at −10, ends at 8, and has a step size of 0.1 between points.
(c) Define the function f(x) = (x − 6)(x 2 − 1)(x + 8) in your script, then plot f(x) against x.
(d) Plot the x- and y-axes on the plot in part (c). Mark each of the x-intercepts on this plot (you will need the hold on command).
(e) Label the x- and y-axes (you will need the xlabel and ylabel commands).
In: Computer Science
C++
Build a struct with many data members inside (for example, a large array). Design any function that processes the data inside the struct (e.g. adding a few values together and returning the sum.) Write two versions of this function, one that passes by value and one that passes a const reference. Measure the time required to call each function 10,000 times.
In: Computer Science
I wrote a c++ program that is suppose to calculate the interest on a CD account but, I cant get the formula to calculate it correctly. please help.
#include <iostream>
#include <cmath>
using namespace std;
struct account
{
double balance;
double interest_rate;
int term;
};
void info(account& accountinfo);
int main(void)
{
double calc1, calc2;
account accountinfo;
info(accountinfo);
calc1 = (accountinfo.interest_rate / 100) + 1;
calc2 = pow(calc1, accountinfo.term);
accountinfo.balance = accountinfo.balance * calc2;
cout << " " << endl
<< " The balance of your CD account after it has matured in " << accountinfo.term << endl
<< " at a interest rate of " << accountinfo.interest_rate << " will be " << accountinfo.balance << endl
<< " " << endl;
return 0;
}
void info(account& accountinfo)
{
cout << " " << endl
<< " This program calculates the value of a CD after maturity. " << endl
<< " " << endl
<< " Enter the balance on the account. " << endl;
cin >> accountinfo.balance;
cout << " " << endl
<< " Enter the interest rate for the CD. " << endl
<< " " << endl;
cin >> accountinfo.interest_rate;
cout << " " << endl
<< " Enter the term for the CD to achieve maturity. " << endl
<< " " << endl;
cin >> accountinfo.term;
}
In: Computer Science
also well known in the housing estate industry. Its products include household furniture, office furniture
and industrial furniture. In the housing estate industry, it has partnership agreements with contractors to roof houses, fix doors and windows and provide all the furniture in the estate houses and office accommodation units that are being constructed by the latter. Its unique finishings are enhanced by the modern equipment, well-trained and flexible workforce including carpenters, joiners and other staff that are in its workshops and showrooms spread around the country.
The success of Unique Furniture is partly driven by its parent company, PK Wood Processing, a timber processing company based in Samboa that supplies quality wood to the latter on a regular basis and at a reduced cost. From the supply of materials through processing, transportation of finished products and installations, the company appears to have a perfect coordination of activities that is making it perform better than its competitors. The company has a five-year maintenance free policy with its customers.
Required:
(b) Draw a value chain to illustrate the activities of Unique Furniture Limited.
In: Operations Management
Make a program to perform Heap Sort, must run in Alice programming only. Only correct answers needed should be in given language Wrong answers will be downvoted
In: Computer Science
Unique Furniture Limited is one of the leading producers of wood furniture in Ghana and is also well known in the housing estate industry. Its products include household furniture, office furniture
and industrial furniture. In the housing estate industry, it has partnership agreements with contractors to roof houses, fix doors and windows and provide all the furniture in the estate houses and office accommodation units that are being constructed by the latter. Its unique finishings are enhanced by the modern equipment, well-trained and flexible workforce including carpenters, joiners and other staff that are in its workshops and showrooms spread around the country.
The success of Unique Furniture is partly driven by its parent company, PK Wood Processing, a timber processing company based in Samboa that supplies quality wood to the latter on a regular basis and at a reduced cost. From the supply of materials through processing, transportation of finished products and installations, the company appears to have a perfect coordination of activities that is making it perform better than its competitors. The company has a five-year maintenance free policy with its customers.
Required:
(b) Draw a value chain to illustrate the activities of Unique Furniture Limited.
In: Operations Management
Discussion
Have you ever witnessed an emergency situation? Did you intervene or were you a bystander? What factors influenced your decision to either get involved or stand aside? If you have never witnessed an emergency situation, how do you think you would react?
In: Psychology