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
Introduction: Programmers for a Better Tomorrow
Programmers for a Better Tomorrow is an organization dedicated to helping charities, medical societies, and scholarship organizations manage various tasks so that they can focus on making the world a better place! They have asked you and your classmates to help them develop some new programs to benefit their organizations.
After nearly a semester of C programming, you've decided that you'd like to donate your skills to create a program that organizes the typical activities for charity run weekend. In particular, your program will help manage the following:
1) Individual Registration
2) Team Registration
3) Running Events
4) Donation Totals
Your program will log the number of teams and individual who are signed up for the different races, process the racing events to see who has the fastest times, and track the total amount of money raised by teams and individuals for charity.
Header Specification
To facilitate grading, include in your header comment which portions of the assignment you have completed. You must complete all portions in order to earn full credit, but partial credit is available for completing some of the steps. The primary steps are as follows:
(1) Processing Individual Registrations
(2) Processing Team Registrations
(3) Processing the running events
(4) Calculating total donations
If your comment is accurate, meaning that you pass the appropriate tests cases corresponding to your choice, you'll earn 10 points. If your comment is roughly accurate, meaning that you sincerely attempted the items you listed, and most of them work minus a tiny bug, then you'll get 5 of these points. If your comment isn't accurate to a reasonable degree, you'll get 0 of these points.
The reason this is here is because it's very important to communicate to others accurately what you've accomplished and what is left to accomplish. This sort of honesty and ability to appraise your own work is a critical skill in a job.
Program Details
Individual Registration Details
There are a two registration windows: early registration and regular registration. Prices for registering early and regularly will be given. Each individual will have a unique number and must be processed separately to record their name, age, running event, and donations raised. The maximum number of runners for our program will be 10000.
Team Registration Details
Teams may be created and registered to sign up several participators at once. Teams may only sign up during early registration, have between 3 and 50 members, and must pay the team registration fee for every member on the team. Teams should be recorded with their name and number of members. Each member of the team still needs to be recorded with their name, age, running event, and donations raised. We can organize at most 200 teams.
Running Events Details
There will be three running events: a 5k race, a 10k race, and a marathon race. For each race, your program will receive the running time for each participant in the race. For the 5k and the 10k you should print the runner with the fastest time. For the marathon, your program will need to check times against the required qualifying times to see which runners qualify for more marathon races. These qualifying times vary by age group.
Total Donation Details
After all the races are run we want to recognize the participants who raised the most money for charity. Print the team that raised the most money for the event along with the amount raised. Then for each team, print the team member who raised the most money along with the amount raised. For the individuals, print the top individual who raised the most money along with the amount raised. Finally, print the total amount raised for the event. All donations and registration fees will be donated directly to charity.
Implementation Restrictions
You must use the following constants:
#define TEAMS 200
#define RUNNERS 10000
#define LENGTH 20
#define TEAMSIZE 50
You must use the following structures to store information:
struct person {
char name[LENGTH];
int number;
int age;
int event;
float money;
float time;
};
struct team {
char name[LENGTH];
int nummembers;
float money;
struct person members[TEAMSIZE];
};
It is not sufficient to simply have the structures in your program, you must use them store information and process operations for the program.
Though function prototypes will not be provided, it is expected that you follow good programming design and create several functions with well-specified tasks related to the solution of this problem. Make sure to pay very careful attention to parameter passing.
Input Specification
The first line of the file contains the following three values, separated by spaces:
Cost of early registration for individuals (in dollars), Cost of regular registration for individuals (in dollars), and the cost of team registration (in dollars). These will be positive real numbers to two decimal places.
The second line of the file will contain one positive integer representing the number of early individuals and teams who are registering. Every registration will start with either TEAM or INDV for a team registration or individual registration respectively.
Lines that begin with INDV will be followed by four values, separated by spaces:
The individual’s name, their age, their chosen running event, and the amount of donations they have raised. The first is a string, the second is a positive integer, the third is an integer from the set {5, 10, 42}, and the fourth is a positive real number.
Lines that begin with TEAM will be followed by two values, separated by spaces: the name of the team and the number of team members (k). This will be followed by k lines organized the same as the individual registration above.
After early registration completes, normal registration can begin. This will be represented by one positive integer (m) representing the number of regular registrations. All teams must use early registration. This will be followed by m lines each with four values. These are the same values that are present in individual registration: The team member’s name, their age, their chosen running event, and the amount of donations they have raised. The first is a string, the second is a positive integer, the third is an integer from the set {5, 10, 42}, and the fourth is a positive real number.
After registration, the running events can occur. Every registered participant will be listed with their number (assigned as part of registration) and the time it took them to run the race in minutes represented as a real number.
This will be followed by 10 lines of qualifying times based on age groups. They will be specified:
STARTINGAGE ENDINGAGE TIME
where starting age and ending age are integers, and the qualifying time is a real number representing minutes.
Output Specification
For an individual registering for an event print a line of the form:
X registered for the Y race! They have been assigned the number Z.
where X is their name and Y is the event they are registering for. Y is represented by an integer {5, 10, 42} in the input file. Replace it with “5k” for the first integer, “10k” for the second integer, and “marathon” for the third integer in this print statement. Z is their unique runner number. These numbers should start at 1 and count up to a max of 10000.
For a team registering print a line with one of the form:
X team registered for the event. They have Y members:
where X is the team name and Y is their number of members. Follow this with Y lines of the same form as the individuals: one for each member of the team.
For the 5k race and the 10k race, output a single line of the following form:
Xk race: Y had the fastest time with Z.Z minutes!
where X is either 5 or 10 respectively, Y represents the name of the fastest runner and Z represents their time.
For the marathon race, print out all the runners who times meet the qualifying times:
X qualified in the marathon run with a time of Y.Y minutes!
where X represents the name of the fastest runner and Y represents their time.
For the team that raised the most money, output a single line of the following form:
The X team raised the most money with a team donation of $Y.YY!
where X is the team name and Y is the amount they raised.
For each team, print out the person that raised the most with a single line of the following form:
X raised the most money on team Y with a donation of $Z.ZZ!
where X is the person’s name, Y is the team name, and Z is the amount they raised.
For the individual that raised the most money, output a single line of the following form:
X raised $Y.YY!
where X is the person’s name and Y is the amount they raised.
End with the total amount raised by the event:
The runners raised $X.XX for charity!
Sample Input/Output
Four sets of input and output are provided with the assignment, showing the different portions of the assignment. You should try to complete race01 first, then proceed to race02, and so forth.
race01.txt
25.5 35.75 21
5
INDV Emily 30 5 10
INDV Karla 27 10 25.6
INDV Martin 45 5 33.75
INDV Lucas 23 42 100
INDV Hayley 34 42 27.43
7
George 50 10 90.3
Evelyn 47 5 15.4
Linus 55 10 22.8
Charlie 40 42 150.75
Lucy 24 10 14.89
Leah 42 5 23.45
Thomas 29 5 10.6
race02.txt
25.5 35.75 21
7
INDV Emily 30 5 10
INDV Karla 27 10 25.6
INDV Martin 45 5 33.75
TEAM OATS 5
Maria 22 5 15.62
Caleb 41 10 20.5
Michael 30 42 18.75
Lily 33 10 31.15
Charlotte 29 5 25.8
INDV Lucas 23 42 100
INDV Hayley 34 42 27.43
TEAM RAINBOW 3
Lawrence 56 5 33.75
David 55 5 33.75
Josie 60 5 33.75
7
George 50 10 90.3
Evelyn 47 5 15.4
Linus 55 10 22.8
Charlie 40 42 150.75
Lucy 24 10 14.89
Leah 42 5 23.45
Thomas 29 5 10.6
race03.txt
25.5 35.75 21
7
INDV Emily 30 5 10
INDV Karla 27 10 25.6
INDV Martin 45 5 33.75
TEAM OATS 5
Maria 22 5 15.62
Caleb 41 10 20.5
Michael 30 42 18.75
Lily 33 10 31.15
Charlotte 29 5 25.8
INDV Lucas 23 42 100
INDV Hayley 34 42 27.43
TEAM RAINBOW 3
Lawrence 56 5 33.75
David 55 5 30.15
Josie 60 5 13.79
7
George 50 10 90.3
Evelyn 47 5 15.4
Linus 55 10 22.8
Charlie 40 42 150.75
Lucy 24 10 14.89
Leah 42 5 23.45
Thomas 29 5 10.6
1 40
2 75
3 35
4 30
5 80
6 200
7 82
8 32
9 230
10 213
11 37
12 25
13 33
14 78
15 31
16 82
17 235
18 77
19 36
20 29
18 34 215
35 39 220
40 44 225
45 49 235
50 54 240
55 59 250
60 64 265
65 69 280
70 74 295
75 79 310
race04.txt
25.5 35.75 21
7
INDV Emily 30 5 10
INDV Karla 27 10 25.6
INDV Martin 45 5 33.75
TEAM OATS 5
Maria 22 5 15.62
Caleb 41 10 20.5
Michael 30 42 18.75
Lily 33 10 31.15
Charlotte 29 5 25.8
INDV Lucas 23 42 100
INDV Hayley 34 42 27.43
TEAM RAINBOW 3
Lawrence 56 5 33.75
David 55 5 30.15
Josie 60 5 13.79
7
George 50 10 90.3
Evelyn 47 5 15.4
Linus 55 10 22.8
Charlie 40 42 150.75
Lucy 24 10 14.89
Leah 42 5 23.45
Thomas 29 5 10.6
1 40
2 75
3 35
4 30
5 80
6 200
7 82
8 32
9 230
10 213
11 37
12 25
13 33
14 78
15 31
16 82
17 235
18 77
19 36
20 29
18 34 215
35 39 220
40 44 225
45 49 235
50 54 240
55 59 250
60 64 265
65 69 280
70 74 295
75 79 310
In: Computer Science
1. Write a python code that uses the Runge Kutta Method method to approximate the solutions to each of the following initial-value problems and compare/plot the results to the actual values.
a) y′=te^(3t) − 2y, 0 < t < 1, y(0) = 0
with h = 0.5; actual solution y(t)=1/5te^(3t) − 1/25e^(3t) + 1/25e^(−2t).
- Use the Runge Kutta method to approximate/plot the solutions to each of the following initial-value
b) ?′=1+(?−?)2,2<?<3,?(2)=1y′=1+(t−y)2,2
c) ?′=1+??,1<?<1,?(1)=2y′=1+yt,1
In: Computer Science
Give the tuple calculus expressions for each using the below schema: Make a database up if needed
SPERSON(EmpID, Name, Dept)
TRIP(TripID, EmpID, ToCity, StartDate, EndDate)
EXPENSE(ExpID, TripID, AccountID, Amount)
a) List the names and employee ID of a salesperson.
b) List employee ID and employee names that took a trip(s) to New York city.
c) List the names of all employees who have spent more than $700 on their trip.
d) List employees' names and their IDs that have never taken a trip.
e) List the names of all salespersons that have at least been on one trip.
In: Computer Science
Exercise
The architectural description plays the role of the medium for
communicating design decisions among stakeholders through the
actual models of the description. The IEEE has published, a
document clarifying the recommended practice to Standardize
architectural descriptions of software systems. The standard does
not identify what views an architectural description should have,
but rather how those views should be specified. In order to create
an architectural description, you should know the following
statements: A system fulfills at least one mission and it is
influenced by its environment. Each system has an architecture.
This latter has an architectural description. An architectural
description is a set of representation models grouped into views.
Views represent certain aspects of the system, each addressing a
set of related concerns. Many stakeholders can share one concern
and each stakeholder can have many concerns. Views are specified by
viewpoints. A viewpoint identifies system stakeholders and the
concerns addressed, as well as modeling languages and modeling
techniques used to create views. The modeling languages and
modeling techniques are considered the Viewpoint Library. In the
terminology of the IEEE, a system has an architecture, which is
described by an architectural description. 1/2 An architectural
description is organized by one or more views, each of which
consists of one or more models and conforms to a viewpoint. An
architectural description selects one or more viewpoints, each of
which covers one or more stakeholder concerns. An effective
architectural description identifies a target audience (the
stakeholders) and their concerns.
Design the correspondent class diagram. [CLO
2.1]
In: Computer Science