In most organizations, a long list of “to-do” projects for
development exists. Since each organization only has limited staff
and financial resources to accomplish the long list of IT project
it is important to know how to identify, classify and select which
projects will be undertaken.
Describe what occurs during project identification, classification
and selection. Why can this process be challenging at times?
In: Computer Science
IN JAVA
Lab 10
This program reads times of runners in a race from a file and puts them into an array. It then displays how many people ran the race, it lists all of the times, and if finds the average time and the fastest time.
In BlueJ create a project called Lab10
Text File: times1.txt
12.4321 23.543 10.23 16.342 21.12
Text File: times2.txt
14.473 17.5 21.178 11.8 9.874 18.71 19.801 14.310 20.7 12.78 9.915 11.789
main method to be used for lab
import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class Main { public static void main(String [] args) { //DO NOT CHANGE MAIN double average; double fastest; double [] times; times = new double[50]; int numRacers; numRacers = fillArray(times); System.out.println("\nThere were " + numRacers + " people in the race "); // Hint: You may want to comment out the following lines of code until you // get the method fillArray to work (use the debugger to check if it is // working. Then uncomment the next method call you are implementing and // get that to work. Do one method at a time. System.out.println("\nThe times were: "); printTimes(times, numRacers); average = findAverage(times, numRacers); System.out.printf("The average time was: %.2f%n", average); fastest = findFastest(times, numRacers); System.out.printf("The fast time was: %.2f%n", fastest); } public static int fillArray(double [] array) { int numElems = 0; Scanner keyboard = new Scanner(System.in); String fileName; System.out.print("Enter the file name: "); fileName = keyboard.next(); // Part A // Declare a input file Scanner and link it to the filename the user // typed in. Make sure the file opens correctly and if it doesn't print // and error message to the screen and exit the program. // Part B // Code the loop that will read in the numbers from the file and put them // into the array. The integer numElems should keep track of how many numbers // are being placed into the array // Part C // Close the file // Part D // return the number of elements in the array } public static void printTimes(double [] array, int numElems) { // Part E // Write the loop to print the array to the screen as shown } public static double findAverage(double [] numbers, int numE) { // Part F // Write the code required to calculate the average of all of the // numbers in the array The method should return the average. If // there are no elements in the array it should return a -1 } // Part G // Write the method to find the fastest time in the array. The method // should return the fastest time. If there are no times in the array // the method should return a -1 }
Sample Output 1
Enter the file name: times1.txt There were 5 people in the race The times were: 12.43 23.54 10.23 16.34 21.12 The average time was: 16.73 The fast time was: 10.23
Sample Output 2
Enter the file name: times2.txt There were 12 people in the race The times were: 14.47 17.50 21.18 11.80 9.87 18.71 19.80 14.31 20.70 12.78 9.92 11.79 The average time was: 15.24 The fast time was: 9.87
In: Computer Science
Write code:
using R to combine two pictures into one picture and save it. For example put imagin1.png into image2.png and save it as imagin3.png.
In: Computer Science
Create a basic functioning Deep Belief Network coding using C++ or MATLAB.
In: Computer Science
Express the binary strings in the left column of the following table in hexadecimal notation in the right column of the table.
Binary string |
Binary string expressed in hexadecimal notation |
1111000011110000 |
|
1010111010101110 |
|
1111000111011111 |
|
11110000110110001101 |
|
10001100111011111000 |
Add the bit strings in the first two columns of the following table and report the answer in the last column in binary notation.
Bit string 1 |
Bit string 2 |
Result of the addition in binary notation |
111101 |
111110 |
|
100010 |
110011 |
|
111011 |
101111 |
|
110001 |
100001 |
|
1111101 |
1001111 |
In: Computer Science
// -Type in your name in the space provided above in this
comment header.
// -Fill in the code that will perform the actions. See the
comments
// (in the code) that describes what to do.
// -The output must match the output given to you by the
instructor.
// -After the last brace, in this code on a new line, make a
comment
// stating your name and what your major is at
PSU.
//=====================================================================
import java.util.Scanner;
import java.util.*;
import java.util.ArrayList;
public class W7_InClass_Lab
{
static ArrayList<String> players = new
ArrayList<String>(Arrays.asList
("Frank", "Chase", "Ryan", "Carlos", "Cole", "Jimmy"));
//---------------------------------------------------------------------
public static void main(String[] args)
{
int n, idx;
boolean itWorked;
Scanner kb = new Scanner (System.in);
System.out.println ("\n(1-6): Testing student
knowldege with ArrayLists.");
System.out.println ("Before: " +
players.toString());
//-- (1) Check to see if "Carlos" is on the list.
Display a msg
//-- stating whether he is in the list or not.
//-- (2) Remove "Frank" from list.
//-- (3) Add "Pedro" to the list, before "Jimmy".
//-- (4) Add "Shane" to the end of list.
//-- (5) Find out how many players are in the
list.
//-- (6) Print out the Array List with all of the
changes.
System.out.println ("After: " +
players.toString()); // xxxx
//-- (7) Use the code below that converts an
integer to binary.
//-- Add code so there is a spave between
every 8 bits, to make the
//-- output more redable.
String binaryStr = "";
int saveInt, intValue, quotient, remainder;
int cnt = 0;
System.out.println ("\n(7) Converting an unsigned
Integer to binary.");
System.out.print ("Enter an integer value: ");
intValue = kb.nextInt();
if (intValue >= 0)
{
saveInt = intValue;
while (intValue > 0)
{
remainder =
intValue % 2;
intValue =
intValue / 2;
binaryStr =
(char)(remainder+48) + binaryStr;
}
System.out.printf ("After
Conversion: %d(10) = %s(2).\n", saveInt, binaryStr);
}
//-- (8) Use the array called grades, below.
//-- starting with index 0m use a for loop
to change every other
//-- grade to 100.
//-- Printf what the array was BEFORE the
changes, and AFTER then Changes.
System.out.println ("\n(8) Laying with an
array");
int grades[] = { 87, 95, 65, 70, 77, 99, 0, 65, 25, 80, 90, 11 };
//-- (9) Don't allow the quadratic formula below to
crash.
//-- Add checks for the two possible ways the formula
can crash.
//-- Print out different msgs stating what the problem
is,
//-- Otherwise do the calculations
double a, b, c;
double underRadical, denominator, answer1,
answer2;
System.out.println ("\n(9)Calculating the quadratic
formula: ");
System.out.print ("Enter a value for a: ");
a = kb.nextDouble();
System.out.print ("Enter a value for b: ");
b = kb.nextDouble();
System.out.print ("Enter a value for c: ");
c = kb.nextDouble();
underRadical = (b * b) - (4 * a * c);
denominator = 2 * a;
answer1 = ((-1.0 * b) - Math.sqrt(underRadical)) /
denominator;
answer2 = ((-1.0 * b) + Math.sqrt(underRadical)) /
denominator;
System.out.println();
System.out.printf ("Quad.Form., negative answer =
%.4f.\n", answer1);
System.out.printf ("Quad.Form., positive answer =
%.4f.\n", answer2);
} // end-main
} // end-class
In: Computer Science
1.Read from a file that contains a paragraph of words. Put all the words in an array, put the valid words (words that have only letters) in a second array, and put the invalid words in a third array. Sort the array of valid words using Selection Sort. Create a GUI to display the arrays using a GridLayout with one row and three columns. 2.The input file Each line of the input file will contain a sentence with words separated by one space. Read a line from the file and use a StringTokenizer to extract the words from the line. An example of the input file would be:
Mary had a little lamb whose fl33ce was white as sn0w And everywhere that @Mary went the 1amb was sure to go. 3.You should have two files to submit for this project: Project1.java WordGUI.java
4. simple Java project
5. All variables have descriptive names or comments describing their purpose.
Thank you!
In: Computer Science
write a bash shell script using the for-loop construct that counts the number of files and directories looping through the files in the directory name provided by the user on a prompt by the script and prints "TOO many files" is the count of files is larger than a random number it generates between 20 and 40
In: Computer Science
In: Computer Science
In: Computer Science
In: Computer Science
Write a python code that uses the Euler Implicit method to approximate/plot the solutions to each of the following initial-value
In: Computer Science
7. Amdahl’s law provides a very useful metric to measure speedup when we make applications parallel using more resources. However, Amdahl’s law’s basic form makes an assumption about the application that may not hold in real-world scenarios. State the assumption made by Amdahl’s law and describe conditions that may break the assumption.
In: Computer Science
Write a member method named countMin. This method is inside the class SingleLinkedList<E>. So it has the direct access to Node<E> class and data fields head, size. This method counts how many times the smallest data item in this SingleLinkedList<E> appears in the list. It is assumed that the class passed to E implements the Comparable<E> interface.
public int countMin()
----------------------
Write a method named endWith. This method is OUTSIDE the class LinkedList<E>. It takes in two parameters: two LinkedList of Integers named list1, list2. It checks if list1 ends with list2, and returns true if yes, false otherwise. list1 ends with list2 if list2 is identical to the tail of list1. For example, list1 below ends with list2 below.
list1: 100 80 200 250 30 20 35
list2: 30 20 35
public static boolean endWith(LinkedList<Integer> list1, LinkedList<Integer> list2)
----------------
Write a method named changeStack that takes in a Stack of Integer objects named stackIn as a parameter and returns another Stack of Integer objects. The returned Stack contains contents that is the result of switching the top half and the bottom half of the stackIn. But the ordering of integers in each half is NOT changed. In the case of odd-size stackIn, the middle element remains in the same position before and after the switch.
This method is OUTSIDE the class <E>.
Example 1:
stackIn Returned Stack
top top
30 100
10 50
100 30
bottom 50 10 bottom
Example 2:
stackIn Returned Stack
top top
15 65
3 8
200 200
65 15
bottom 8 3 bottom
The Stack class includes all methods necessary for the stack operations. You can consider Stack is like the ArrayDeque in Java API used as a Stack.
public static Stack<Integer> changeStack(Stack<Integer> stackIn)
In: Computer Science
Can someone take a look and tell me what I have wrong here. VS 2019 .net framework console app c##
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace dropbox10
{
class MainClass
{
public static void Main(string[] args)
{
//create a list of employees
List<Employee> allEmployees = new List<Employee>();
//create two full time employees
FullTimeEmployee fe1 = new FullTimeEmployee("111", "Alice",
67888.00m);
FullTimeEmployee fe2 = new FullTimeEmployee("222", "Bob",
67555.00m);
//create two part time employees
PartTimeEmployee pe1 = new PartTimeEmployee("333", "Chuck", 22.12m,
20m);
PartTimeEmployee pe2 = new PartTimeEmployee("444", "Dan", 23.33m,
18.45m);
//add employees to list
allEmployees.Add(fe1);
allEmployees.Add(fe2);
allEmployees.Add(pe1);
allEmployees.Add(pe2);
//display data
foreach (Employee emp in allEmployees)
{
Console.WriteLine(emp);
}
Console.ReadKey();
}
}
}
//the required employee class
class Employee
{
//fields
private string employeeId;
private string employeeName;
//properties
public string EmployeeId
{
get { return employeeId; }
set { employeeId = value; }
}
public string EmployeeName
{
get { return employeeName; }
set { employeeName = value; }
}
public Employee(string employeeId, string employeeName)
{
this.employeeId = employeeId;
this.employeeName = employeeName;
}
//required toString method
public override string ToString()
{
string str;
str = string.Format("ID: {0} Name: {1}", EmployeeId,
EmployeeName);
return str;
}
}
//the required class
class FullTimeEmployee : Employee
{
//field
private decimal annualSalary;
//property
public decimal AnnualSalary
{
get { return annualSalary; }
set { annualSalary = value; }
}
//consturtor
public FullTimeEmployee(string employeeId, string employeeName,
decimal annualSalary)
: base(employeeId, employeeName)
{
this.annualSalary = annualSalary;
}
//GetweeklyPaid() method
public decimal GetWeeklyPaid()
{
decimal payAmount;
payAmount = AnnualSalary / 52;
return payAmount;
}
//ToString() method
public override string ToString()
{
string str;
str = base.ToString() + string.Format(" Pay amount: {0:C}",
GetWeeklyPaid());
return str;
}
class PartTimeEmployee : Employee
{
//fields
private decimal hourlyWage;
private decimal hoursWorked;
//properties
public decimal HourlyWage
{
get { return hourlyWage; }
set { hourlyWage = value; }
}
public decimal HoursWorked
{
get { return hoursWorked; }
set { hoursWorked = value; }
}
//constuctor
public PartTimeEmployee(string employeeId, string
employeeName,
decimal hourlyWage, decimal hoursWorke)
: base(employeeId, employeeName)
{
this.hourlyWage = hourlyWage;
this.hoursWorked = hoursWorked;
}
//GetWeeklyPaid() method
public decimal GetWeeklyPaid()
{
decimal payAmount;
payAmount = HoursWorked * HourlyWage;
return payAmount;
}
//ToString() method
public override string ToString()
{
string str;
str = base.ToString() + string.Format(" Pay amount: {0:C}",
GetWeeklyPaid());
return str;
}
}
}
In: Computer Science