In: Computer Science
The home work is to do a survey comparing the following three
programming language:
COBOL , FOTRAN 77, and PASCAL regarding:
1- Character set.
2- Reserved(key) words and special symbols.
3- Simple data types and data structures used.
4- Control structures used (selection and loop
structures)
5- File structure used.
In: Computer Science
Which of the following is the key exchange that Eve and Mel might use to simultaneously agree on a large prime number and integer?
A. Quantum Prime
B. Prime-Curve
C. Diffie-Hellman
D. Elliptic Curve Diffie-Hellman
In: Computer Science
JAVA
Given the company and Employee interface, create a
findLeastPaid() method (that will do the opposite of whats
below). instead of finding the the best paid convert it
find the lowest paid person.
write a Java program that reads in a file of full time employees
with each line of
input containing the name of the employee (String) and gross Salary
(double) and stores
them in an array list. Then the arraylist of stored employees, find
and print the
less paid employee (name) and his/her pay. If there is more than
one such, print any one
lesst paid employee information.
---------------------------------------------------------------------------------
import java.util.*; // for the Scanner class
import java.io.*;
public class Company
{
public static void main (String[ ] args) throws
FileNotFoundException
{
new Company().run();
} // method main
/**
* Determines and prints out the best paid of the full-time
employees
* scanned in from a specified file.
*
*/
public void run() throws FileNotFoundException // see Section 2.3
{
final String INPUT_PROMPT = "Please enter the path for the file of
employees: ";
final String BEST_PAID_MESSAGE =
"\n\nThe best-paid employee (and gross pay) is ";
final String NO_INPUT_MESSAGE =
"\n\nError: There were no employees scanned in.";
String fileName;
System.out.print (INPUT_PROMPT);
fileName = new Scanner (System.in).nextLine();
Scanner sc = new Scanner (new File (fileName));
FullTimeEmployee bestPaid = findBestPaid (sc);
if (bestPaid == null)
System.out.println (NO_INPUT_MESSAGE);
else
System.out.println (BEST_PAID_MESSAGE + bestPaid.toString());
} // method run
/**
* Returns the best paid of all the full-time employees scanned
in.
*
* @param sc – the Scanner object used to scan in the
employees.
*
* @return the best paid of all the full-time employees scanned
in,
* or null there were no employees scanned in.
*
*/
public FullTimeEmployee findBestPaid (Scanner sc)
{
FullTimeEmployee full,
bestPaid = new FullTimeEmployee();
while (sc.hasNext())
{
full = getNextEmployee (sc);
if (full.getGrossPay() > bestPaid.getGrossPay())
bestPaid = full;
} //while
if (bestPaid.getGrossPay() == 0.00)
return null;
return bestPaid;
} // method findBestPaid
/**
* Returns the next full-time employee from the file scanned by a
specified Scanner
* object.
*
* @param sc – the Scanner object over the file.
*
* @return the next full-time employee scanned in from sc.
*
*/
protected /*private*/ FullTimeEmployee getNextEmployee (Scanner
sc)
{
Scanner lineScanner = new Scanner (sc.nextLine());
String name = lineScanner.next();
double grossPay = lineScanner.nextDouble();
return new FullTimeEmployee (name, grossPay);
} // method getNextEmployee
} // class Company
---------------------------------------------------------------------------------
import java.text.DecimalFormat;
public interface Employee
{
final static DecimalFormat MONEY = new DecimalFormat ("
$0.00");
// a class constant used in formatting a value in dollars and
cents
/**
* Returns this Employee object’s name.
*
* @return this Employee object’s name.
*
*/
String getName();
/**
* Returns this Employee object’s gross pay.
*
* @return this Employee object’s gross pay.
*
*/
double getGrossPay();
/**
* Returns a String representation of this Employee object with the
name
* followed by a space followed by a dollar sign followed by the
gross
* weekly pay, with two fractional digits (rounded).
*
* @return a String representation of this Employee object.
*
*/
String toString();
} // interface Employee
---------------------------------------------------------------------------------
public class FullTimeEmployee implements Employee
{
protected /*private*/ String name;
protected /*private*/ double grossPay;
public FullTimeEmployee()
{
final String EMPTY_STRING = "";
name = EMPTY_STRING;
grossPay = 0.00;
} // default constructor
/**
* Initializes this FullTimeEmployee object's name and gross pay
from a
* a specified name and gross pay.
*
* @param name - the specified name.
* @param grossPay - the specified gross pay.
*
*/
public FullTimeEmployee (String name, double grossPay)
{
this.name = name;
this.grossPay = grossPay;
} // 2-parameter constructor
/**
* Returns the name of this FullTimeEmployee object.
*
* @return the name of this FullTimeEmployee object.
*
*/
public String getName()
{
return name;
} // method getName
/**
* Returns the gross pay of this FullTimeEmployee object.
*
* @return the gross pay of this FullTimeEmployee object.
*
*/
public double getGrossPay()
{
return grossPay;
} // method getGrossPay
/**
* Returns a String representation of this FullTimeEmployee object
with the
* name followed by a space followed by a dollar sign followed by
the gross
* weekly pay, with two fractional digits (rounded), followed by "
FULL TIME".
*
* @return a String representation of this FullTimeEmployee
object.
*
*/
public String toString()
{
final String EMPLOYMENT_STATUS = " FULL TIME";
return name + MONEY.format (grossPay) + EMPLOYMENT_STATUS;
// the format method returns a String representation of
grossPay.
} // method toString
} // class FullTimeEmployee
In: Computer Science
Write a C program.
Problem 1: You are given two sorted arrays, A and B, and A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted order without using any other array space. Implementation instruction:
(1) Define one array of size 18 for A and the other array of size 5 for B.
(2) Initialize A by inputting 13 integers in the ascending order, and Initialize B by inputting 5 integers in the ascending order. (Note: don’t hard code the integers of the arrays.)
(3) Merge B with A in a way all values are sorted.
(4) Print out the updated array A, after merging with B. For example: If your input for A is 1, 3, 11, 15, 20, 25, 34, 54, 56, 59, 66, 69, 71 and your input for B is 2, 4, 5, 22, 40 Finally, after merging A and B, A becomes 1, 2, 3, 4, 5, 11, 15, 20, 22, 25, 34, 40, 54, 56, 59, 66, 69, 71
In: Computer Science
Research Methods & Designs: Write a 5-page (3 pages of content) description of qualitative, quantitative, and mixed methods research methodologies including: • the characteristics of each research method, • when the use of each research method is most appropriate, • and similarities and differences in the research methods. Describe the research method and research design that best fits your major area of study including: • the reasons for selecting the research method, • the reasons for selecting the research design, • and why it is the best fit for research conducted in your major area of study.
In: Computer Science
Python:
Implement a function called monthlyAmortization() that takes the following parameters:
the principal amount of the loan (p)
the interest rate, or annual rate (r)
the term of the loan in months (t)
the payment amount each period (monthlyPayment)
The function prints the amortization table to a file called amoritizedLoan.txt.
At the end of this file, the fucntion prints the total amount of interest paid for the loan.
The output needs to be nicely formatted as shown below.
The example has the following parameters: for p = 100,000; r = 6% yearly; monthlyPayment = 599.55; t = 30 years, or 360 months:
>>> monthlyAmortization(100000, .06, 360, 599.55)
>>>
The output file amortizedLoan.txt:
Your amortized loan of $100,000.00 for 360 months at 6.0% annual interest rate.
Month Principal Interest Payment Principal Payment Ending Principal
1 $100,000.00 $500.00 $99.55 $99,900.45
2 $99,900.45 $499.50 $100.05 $99,800.40
3 $99,800.40 $499.00 $100.55 $99,699.85
………………………………………………………………..
358 $1,781.33 $8.91 $590.64 $1,190.69
359 $1,190.69 $5.95 $593.60 $597.09
360 $597.09 $2.99 $596.56 $0.53
The total amount of interest paid: $115,838.53
-------
The following formulas are helpful:
Remember to convert the annually interest rate to the monthly interest rate: .06/12
Month 1
monthlyInterestPayment = p*r
principalPayment = ($599.55 payment - $500 interest = $99.55 principal payment).
endingPrinciple = principle – principalPayment = 100,000 – 99.55 = 99,900.45
Month 2
principal = last month’s endingPrincipal = 99,900.45
…..
This example was taken from How to Calculate Amortization, October 1, 2019,
https://www.vertex42.com/ExcelArticles/amortization-calculation.html
In: Computer Science
write a program that takes two input values from the user and calculate the division if the first number is greater than the second one otherwise calculate the multiplication.
In: Computer Science
please do it in C++, will up vote!! please add snap shots of result and explanation.
You are to create a recursive function to perform a linear search through an array.
How Program Works
Program has array size of 5000
Load values into the array, equal to its index value. Index 5 has value 5, index 123 has value 123.
Pass array, key, and size to the recursive function:
int recursiveLinearSearch(int array[],int key, const int size, bool & methodStatus)
User enters key to search for, recursive function calls itself until the key is found (methodStatus is true), print out the key and number of function calls when control is returned to the main
Handle situation of key not found (return number of function calls AND methodStatus of false) – print not found message and number of calls in the main
Function returns a count of how many recursive calls were made
Value returned is the number of calls made to that point, that is, when item is found the value returned is 1 with preceding functions adding 1 to the return value until the actual number of recursive function calls are counted).
Determine smallest key value that causes stack-overflow to occur, even if you need to make array larger than 5000.
Test cases need to include, biggest possible key value, “not found” message, and a stack overflow condition.
--------------------------------------
sry mixed 2 questions!
In: Computer Science
in java
Create simple number guessing game as follows. First, prompt the user to enter a min and max value. In your code, declare and assign a variable with a random integer in this range (inclusive). Then, ask the user to guess the number. Input the user's guess. And at the end output "Correct!" if the user's guess was right on spot, or "Sorry, the answer is not corrcet.” The number I was looking for was xxx. Replace xxx with the target number.
In: Computer Science
PURPOSE
This purpose of this assignment is to
enable learners to have a deeper understanding of the
concepts, applications and importance of multimedia in society
(CLO1) as well as the knowledge of multimedia related hardware and
devices. (CLO2)
REQUIREMENT
The era of globalization has indirectly placed a pressure
on educational institution to produce highly specialized and
technical individual. Given the emergence of knowledge-based
society, education system in Malaysia has to realign to meet the
growing demand and competitive market.
Thus, you are required to discuss the use of multimedia technology and its application in providing quality and innovative education in Malaysia. Your discussions also need to include the hardware requirements, challenges and the future of this technology.
Lastly, from your experience as 21st-century learners, suggest any two multimedia technology that you would like OUM to adopt that will enhance your learning experience in OUM especially during the current Covid-19 pandemic.
In: Computer Science
Consider the following page reference string:5, 1, 5, 5, 3, 6, 2, 3, 0 , 7, 2, 5, 2, 1, 7, 2, 3, 1, 4, 6.Assuming demand paging with three frames, how many page faults would occur for the following replacement algorithms?• LRU replacement• FIFO replacement• Optimal replacement
In: Computer Science
Write a method named minimumValue, which returns the smallest value in an array that is passed (in) as an argument. The method must use Recursion to find the smallest value. Demonstrate the method in a full program, which does not have to be too long regarding the entire code (i.e. program). Write (paste) the Java code in this word file (.docx) that is provided. (You can use additional pages if needed, and make sure your name is on every page in this word doc.) Use the following array to test the method: int[] seriesArray = {-5, -10, +1999, +99, +100, +3, 0, +9, +300, -200, +1, -300} Make sure that the seriesArray only tests for values, which are positive, given your recursive method.
In: Computer Science
Write the following Python script:
Write a function called linsolve() that will be useful in categorizing and solving linear algebra problems. The function will have up to three parameters:
• A required 2D array representing the coefficient matrix of a linear algebra equation,
• A required 1D or 2D array representing the right-side constants of a linear algebra equations, and
• An optional parameter used to determine which condition number to use in determining the condition of the system. The default case for this is the integer 2.
The returns for this function will depend on whether there is a unique solution to the system. If there is, the three returns should be, in order:
• A 1D or 2D array representing the solution array of the linear system,
• A float representing the determinant of the coefficient matrix, and
• A float representing the condition number of the coefficient matrix.
If there is no unique solution, the function should return None for the solution array, 0 for the determinant, and -1 for the condition number; the function should also print out “No solution.”
In: Computer Science
Please identify each error present, explain the type of error (syntax/logic/run-time), and provide a fix which changes the given code as little as possible (i.e. don't rewrite the whole thing; just point out what is wrong and a fix for it).
5)
// Assign a grade based on the score
char score;
cin>>score;
if score < 0 && score > 100
cout<<"The score entered is
invalid"<<endl;
if (score <= 90)
grade = "A";
if (score <= 80)
grade = "B";
if (score <= 70)
grade = "C";
if (score <= 60)
grade = "D";
else
grade = "F";
6)
// if GPA 3.5 or better the student makes the dean's list, if
completedUnits 182 or more the student can graduate.
// if both, the student can graduate with honors
string gpa, completedUnits;
cin>>gpa>>completedUnits;
if (gpa > 3.5)
cout<<"Good job!\n";
cout<<"You've made the dean's
list!\n";
else if (completedUnits > 54)
cout<<"You have completed the
required number of units.\n";
cout<<"You can
graduate!\n";
else if (gpa > 3.5 || completedUnits > 54)
cout<<"Great job!\n";
cout<<"You have completed the
required number of units with a high GPA.\n";
cout<<"You are graduating with
honors!\n";
7)
// sum all the even numbers from 0 to 100, inclusive
int value = 0;
int sum;
while (sum < 100)
sum += value
value*=2;
8)
// get numbers from the user until the user enters 0. Output how
many numbers were entered and their sum.
int count;
while (input == 0)
int input;
cin>>input;
sum = sum + input;
count++;
cout<<"You entered "<<count<<"
values"<<endl;
cout<<"The sum is "<<sum<<endl;
9)
// sum all the numbers which are divisible by 3 or by 5 and in the
range 0 to 1000 inclusive
int sum;
for (i=0; i<1000; sum++)
if (sum % 3 || sum % 5)
sum += i;
cout<<"The sum is "<<sum<<endl;
In: Computer Science