Explanation:
The outlines given in question statement can be written in many programming languages. The below program would be written in C language, which is one of the basic computer languages
Program code
String main (int MAX_SEV_IR)
{
string INJURY
if (MAX_SEV_IR = =1 or MAX_SEV_IR == 2)
INJURY = "yes"
elseif (MAX_SEV_IR = =0)
INJURY = "No"
else
INJURY = "Invalid data"
return INJURY
}
Answer:
# main function is defined
def main():
# the value of MAX_SEV_IR is gotten
# from the user via keyboard input
MAX_SEV_IR = int(input ("Enter MAX_SEV_IR: ")
# if statement to check for prediction
# if MAX_SEV_IR == 1 or 2
# then there is injury and it is displayed
if (MAX_SEV_IR == 1 or MAX_SEV_IR == 2):
print("INJURY = ", injury)
print("PREDICTION: Accident just reported will involve an injury")
# else if MAX_SEV_IR == 0 then no
# injury and it is displayed
elif (MAX_SEV_IR == 0):
injury = "NO"
print("INJURY = ", injury)
print("PREDICTION: Accident just reported will not involve an injury")
# the call main function to execute
if __name__ = '__main__':
main()
Explanation:
The code is written in Python and well commented.
PLEASE HELP
The equation SF=0 is the equation for
A. static equilibrium
B. dynamic equilibrium
C. Balanced forces
D. Tension
Modify an array's elements Write a for loop that iterates from 1 to numberSamples to double any element's value in dataSamples that is less than minValue. Ex: If minVal = 10, then dataSamples = [2, 12, 9, 20] becomes [4, 12, 18, 20]. Function Save Reset MATLAB DocumentationOpens in new tab function dataSamples = AdjustMinValue(numberSamples, userSamples, minValue) % numberSamples: Number of data samples in array dataSamples % dataSamples : User defined array % minValue : Minimum value of any element in array % Write a for loop that iterates from 1 to numberSamples to double any element's % value in dataSamples that is less than minValue dataSamples = userSamples; end 1 2 3 4 5 6 7 8 9 10 Code to call your function
Answer:
See explaination for program code
Explanation:
%save as AdjustMinValue.m
%Matlab function that takes three arguments
%called number of samples count, user samples
%and min vlaue and then returns a data samples
%that contains values which are double of usersamples
%that less than min vlaue
%
function dataSamples=AdjustMinValue(numberSamples, userSamples, minValue)
dataSamples=userSamples;
%for loop
for i=1:numberSamples
%checking if dataSamples value at index,i
%is less than minValue
if dataSamples(i)<minValue
%set double of dataSamples value
dataSamples(i)= 2*dataSamples(i);
end
end
end
Sample output:
Note:
File name and calling method name must be same
--> AdjustMinValue(4, [2,12,9,20],10)
ans =
4 12 18 20
In the simulation, player 2 will always play according to the same strategy. The number of coins player 2 spends is based on what round it is, as described below. (a) You will write method getPlayer2Move, which returns the number of coins that player 2 will spend in a given round of the game. In the first round of the game, the parameter round has the value 1, in the second round of the game, it has the value 2, and so on. The method returns 1, 2, or 3 based on the following rules. If round is divisible by 3, then return 3. If round is not divisible by 3 but is divisible by 2, then return 2. If round is not divisible by 3 and is not divisible by 2, then return 1. Complete method getPlayer2Move below by assigning the correct value to result to be returned.
Final answer:
To determine the number of coins that player 2 will spend in a given round of the game, check the rules based on the value of the round: divisible by 3 = 3 coins, divisible by 2 but not by 3 = 2 coins, not divisible by 3 and not divisible by 2 = 1 coin.
Explanation:
To determine the number of coins that player 2 will spend in a given round of the game, we need to check the rules based on the value of the round:
If the round is divisible by 3, player 2 will spend 3 coins.
If the round is not divisible by 3 but is divisible by 2, player 2 will spend 2 coins.
If the round is not divisible by 3 and not divisible by 2, player 2 will spend 1 coin.
So, the method getPlayer2Move should be defined as follows:
public
int getPlayer2Move(int round)
{
if (
round % 3 == 0) { return 3;
}
else if
(
round % 2 == 0
) {
return 2;
} else {
return 1;
} }
Final answer:
The getPlayer2Move method returns 1, 2, or 3 based on the given rules.
Explanation:
The method getPlayer2Move returns 1, 2, or 3 based on the rules given in the question. If the round number is divisible by 3, the method returns 3. If the round number is not divisible by 3 but is divisible by 2, the method returns 2. If the round number is not divisible by 3 and not divisible by 2, the method returns 1. For example, if the round number is 4, which is divisible by 2 but not divisible by 3, the method would return 2.
What is the output of the following C++ program?
#include
#include
using namespace std;
class baseClass
{
public:
void print() const;
baseClass(string s = " ", int a = 0);
//Postcondition: str = s; x = a;
protected:
int x;
private:
string str;
};
class derivedClass: public baseClass
{
public:
void print() const;
derivedClass(string s = "", int a = 0, int b = 0);
//Postcondition: str = s; x = a; y = b;
private:
int y;
};
int main()
{
baseClass baseObject("This is the base class", 2);
derivedClass derivedObject("DDDDDD", 3, 7);
baseObject.print();
derivedObject.print();
system("pause");
return 0;
}
void baseClass::print() const
{
cout << x << " " << str << endl;
}
baseClass::baseClass(string s, int a)
{
str = s;
x = a;
}
void derivedClass::print() const
{
cout << "Derived class: " << y << endl;
baseClass::print();
}
derivedClass::derivedClass(string s, int a, int b) :
baseClass("Hello Base", a + b)
{
y = b;
}
Answer:
0 This is base class
Derived class: 9
16 Hello Base
Explanation:
The header files #include <iostream> #include <string> was wrongly included in the question this had to be edited.
After properly editing the programme to remove errors, the expected output when you run the code is:
0 This is base class
Derived class: 9
16 Hello Base
Final answer:
The C++ program demonstrates class inheritance and method overriding. The output for the baseClass object is "2 This is the base class", and for the derivedClass object is "Derived class: 7" followed by "10 Hello Base".
Explanation:
The provided C++ program defines two classes, baseClass and derivedClass, which demonstrate basic inheritance and method overriding. The main() function creates instances of these classes and calls their print() methods. The output of this program is determined by the details of the print methods.
When baseObject.print() is called, it triggers baseClass::print(), outputting the value of x and str for the base object, which are initialized in the baseClass constructor. The output would be "2 This is the base class".
Calling derivedObject.print() triggers derivedClass::print(), which first outputs the phrase "Derived class: " and the value of y from the derivedClass object, followed by the properties of the base class part of the same object, as per the constructor which passed "Hello Base", a (x in the base class), and the sum a + b. The resulting output would be "Derived class: 7" followed by "10 Hello Base" on a new line.
NOTE: Throughout this lab, every time a screenshot is requested, use your computer's screenshot tool, and paste each screenshot to the same Word document. Label each screenshot in accordance to the step in the lab. This document with all of the screenshots included should be uploaded through Connect as a Word or PDF document when you have reached the final step of the lab. In this lab, you will: 1. Identify questions related to the income statement. 2. Analyze a list of calculated financial ratios for a selection of companies. 3. Create a dynamic spreadsheet that pulls in XBRL data. 4. Create formulas to identify the companies based on the ratios. Refer to Chapter 8 pages 314 through 317 for instructions and steps for each of the lab parts. After completing Lab parts 1 through 4, complete the following requirements. Software needed Google Sheets (sheets.) iXBRLAnalyst script (https://findynamics/gsheets/ixbrlanalyst.gs) Data The data used in this analysis are XBRL-tagged data from Fortune 100 companies. The data are pulled from FinDynamics, which in turn pulls the data from the SEC.
Final answer:
The lab involves analysis of financial ratios, banking operations evaluation using T-account balance sheets, and quantitative modeling in biology, highlighting the importance of data analysis across disciplines.
Explanation:
The request refers to a step-by-step completion of a lab that involves interpreting financial data, specifically using an income statement to calculate various ratios for company analysis. The lab directs students to use specific data analysis tools and apply concepts such as the money multiplier and T-account balance sheets to evaluate banking operations. One part of the lab requires creating a spreadsheet to analyze data in terms of mass fractions relative to sodium, underlining the importance of quantitative modeling skills, even in biology.
Moreover, statistics play a role in the exercise, as students must calculate measures such as mean, standard deviation, median, and interquartile range. The lab encompasses a cross-disciplinary approach, including data analysis in biology and economics, showcasing how quantitative skills are leveraged in diverse fields.
Lastly, the lab also involves learning how to collect and interpret data, which includes skills like observation, sketching, using geography tools, and graphical interpretation. These fundamental skills are critical for successful data analysis in various academic and professional contexts.
Suppose that you sort a large array of integers by using a merge sort. Next you use a binary search to determine whether a given integer occurs in the array. Finally, you display all of the integers in the sorted array. a. Which algorithm is faster, in general: the merge sort or the binary search? Explain in terms of Big O notation. b. Which algorithm is faster, in general: the binary search or displaying the integers? Explain in terms of Big O notation.
Answer:
See explaination
Explanation:
Merge sort working-
1.type of recursive sorting algorithm.
2.divides given array into halves.
3. Sort each halves. Merge this halves to give a sorted array.
4. Recursive call continues till array is divided and each piece has only one element.
5. Merge this small pieces to get a sorted array.
Binary search-
1. It is a search algorithm.
2. Requires a sorted array to work on.
3.Works repetively dividing a half portion of list that could contain item until it has narrowed down the possible location to just one.
Comparing Merge sort and Binary Search using Big O notation-
Merge Sort - O(n*log(n)) in all scenario whether best, average or worst case.
Binary Search- O(log(n)) in average and worst case. O(1) in best case.
So seeing the above comparison Binary search is faster.
Comparing Binary search and displaying the integers-
Binary Search- O(log(n)) in average and worst case. O(1) in best case.
Displaying the integer-O(1) if already initialized, O(n) in case of loop or function.
So seeing above one can conclude that binary search is fast. But in best case both works in a similar manner.
Write the pseudocode for the following: A function called fahrenheitToCelsius that accepts a Real Fahrenheit temperature, performs the conversion, and returns the Real Celsius temperature. A function called celsiusToFahrenheit that accepts a Real Celsius temperature, performs the conversion, and returns the Real Fahrenheit temperature. A main module that asks user to enter a Fahrenheit temperature, calls the fahrenheitToCelsius function, and displays the Celsius temperature with a user-friendly message. It then asks the user to enter a Celsius temperature, calls the celsiusToFahrenheit function, and displays the Fahrenheit temperature with a user-friendly message.
Final answer:
The pseudocode provided defines two functions, fahrenheitToCelsius and celsiusToFahrenheit, which perform temperature conversions between Fahrenheit and Celsius, and a main module for user interaction to perform and display the conversions.
Explanation:
Here is the pseudocode for two temperature conversion functions and a main module to interact with the user.
Function: fahrenheitToCelsius
Input: Real fahrenheitTemperature
Output: Real celsiusTemperature
Begin
Set celsiusTemperature to (fahrenheitTemperature - 32) * (5.0 / 9.0)
Return celsiusTemperature
End
Function: celsiusToFahrenheit
Input: Real celsiusTemperature
Output: Real fahrenheitTemperature
Begin
Set fahrenheitTemperature to (celsiusTemperature * (9.0 / 5.0)) + 32
Return fahrenheitTemperature
End
Main Module
Begin
Display "Enter a Fahrenheit temperature: "
Input fahrenheitTemperature
Set celsiusTemperature to fahrenheitToCelsius(fahrenheitTemperature)
Display "The equivalent Celsius temperature is: " + celsiusTemperature
Display "Enter a Celsius temperature: "
Input celsiusTemperature
Set fahrenheitTemperature to celsiusToFahrenheit(celsiusTemperature)
Display "The equivalent Fahrenheit temperature is: " + fahrenheitTemperature
End
List 3 specific uses for an Excel spreadsheet in the field you are going into. Give specific examples of how you could or have used Excel in the field. Choose examples that you are familiar with, remembering that personal stories always makes a post more interesting
Answer:
The answer to this question can be defined as below:
Explanation:
The three uses of the spreadsheet can be described as follows:
In Business:
All organizations use Excel, which uses daily by Microsoft Excel, as a key feature of the Microsoft Office company Desktop Suite. Spreadsheets preparation manuals contain worksheets for documents and tablets.In Auditing:
It is a function, that be can provide you with several methods for inspecting by constructing 'short cuts' obstacles. Multiple functions have been helpful, and that you have reduced returns with the time it takes for something to be hung up.In nursing:
All related to figures should be available in a list. Health staff may very well use them to calculate their patients, profits and costs. You should keep a list of clients and medication. They may have to keep hospital-based, clients are at the healing facility on weekends, subtle features of hours employed by medical staff and various items.An array of String objects, words, has been properly declared and initialized. Each element of words contains a String consisting of lowercase letters (a–z). Write a code segment that uses an enhanced for loop to print all elements of words that end with "ing".
As an example, if words contains {"ten", "fading", "post", "card", "thunder", "hinge", "trailing", "batting"}, then the following output should be produced by the code segment.
fading trailing batting
Write the code segment as described above. The code segment must use an enhanced for loop.
Answer:
Explanation:
#include <iostream>
using namespace std;
int main()
{
string cwords[8]={"ten", "fading", "post", "card", "thunder", "hinge", "trailing", "batting"};
string temp="";
for (int i=0; i<8; i++)
{
temp=cwords[i];
int j=temp.length();
if (temp[j-3]=='i' && temp[j-2]=='n' && temp[j-1]=='g')
{
cout<<temp<<endl;
}
}
return 0;
}
The code segments must use an enhanced for loop given in the coding language.
What are code segments?A code segment is a chunk of an object file or the corresponding area of the program's source code that is used for programming. It is also referred to as a text segment or simply as text.
#include <iostream>
using namespace std;
int main()
{
string cwords[8]={"ten", "fading", "post", "card", "thunder", "hin-ge", "trailing", "batting"};
string temp="";
for (int i=0; i<8; i++)
{
temp=cwords[i];
int j=temp.length();
if (temp[j-3]=='i' && temp[j-2]=='n' && temp[j-1]=='g')
{
cout<<temp<<endl;
}
}
return 0;
}
Therefore, the code segments are written above.
To learn more about code segments, refer to the link:
https://brainly.com/question/20063766
#SPJ2
Differences between the Services in career paths leading up to a joint assignment may surprise new staff Service members in joint assignments. This demonstrates which key element to remember when working with other services?
Answer:
Prior Experience Working with Senior Officers versus Little or None.
Explanation:
Differences and disparities between the Services in career paths leading up to a joint assignment may surprise new staff officers in joint assignments.
For example, Army and Air Force officers will likely come to a joint assignment with prior junior officer experience as an administrative “exec” to a senior officer at the O-5 and above level.
In contrast, Navy, Marine Corps and Coast Guard officers will have had no such experience unless selected for one of the highly competitive Flag Aide or Aide-de-Camp billets to an O-7 or above who rates such an aide.
Having an experience working with senior officers and when a person has little or none shows the key element to remember when working with other services.
What is the aim of joint operations?The act of working together in a joint project helps to provide some amount of guidance for the use of authority.
Note that having a previous experience in working with senior officers and when a person has little or none can be obviously shown when working with other services.
Learn more about Career from
https://brainly.com/question/9719007
Write a program that takes as input an arithmetic expression followed by a semicolon ";". The program outputs whether the expression contains matching grouping symbols. For example, the arithmetic expressions {25 + (3 – 6) * 8} and 7 + 8 * 2 contains matching grouping symbols. However, the expression 5 + {(13 + 7) / 8 - 2 * 9 does not contain matching grouping symbols. If the expression contains matching grouping symbols, the program output should contain the following text: Expression has matching grouping symbol If the expression does not contain matching grouping symbols, the program output should contain the following text:
Answer:
See explaination for the details of the answer.
Explanation:
#include <iostream>
#include <stack>
using namespace std;
int main(){
string str;
cout<<"Enter a String: ";
std::getline (std::cin,str);
bool flag=true;
stack<char> st;
for(int i=0;i<str.size();i++){
if( (str.at(i)>='0' && str.at(i)<='9') || str.at(i)=='+' || str.at(i)=='-' || str.at(i)=='/'|| str.at(i)=='*' || str.at(i)==' ' ){
// cout<<str.at(i) <<"came"<<endl;
continue;
}
if( str.at(i)=='{' || str.at(i)=='(' ){
st.push(str.at(i));
}
else if(!st.empty() &&((st.top() == '{' && str.at(i) == '}') || (st.top() == '(' && str.at(i) == ')')))
st.pop();
else{
flag=false;
break;
}
}
if(!st.empty()){
cout<<"Does not match"<<"\n";
}else{
if(flag)
cout<<"Match"<<"\n";
else
cout<<"Does not match"<<"\n";
}
return 0;
}
See attachment for the output.
6.1.3: Function call with parameter: Printing formatted measurement. Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a newline. Ex: PrintFeetInchShort(5, 8) prints: 5' 8" Hint: Use \" to print a double quote.
Answer:
public class Main
{
public static void main(String[] args) {
PrintFeetInchShort(5, 8);
}
public static void PrintFeetInchShort(int numFeet, int numInches) {
System.out.println(numFeet + "'" + " " + numInches + "\"");
}
}
Explanation:
Create a function called PrintFeetInchShort that takes two parameters, numFeet, and numInches
Print the given values in required format. Use System.out.println to print the values, ends with a new line.
Inside the main, call the function with two integers as seen in the example
Write a statement that declares a variable of the enumerated data type below. enum Flower { ROSE, DAISY, PETUNIA } The variable should be named flora. Initialize the variable with the ROSE constant.
Answer:
enum Flower { ROSE, DAISY, PETUNIA }
Flower flora = Flower.ROSE
Explanation:
Flower is of Enumeration data type and it contains the constants ROSE, DAISY and PENTUA.
To write a statement that declares a variable of that type you use
Var_of_enum_type Var_name
And to initialize it with a constant of the enumeration data type you use the dot (.) operator.
Var_of_enum_type.CONSTANT
Write a program to read 10 integers from an input file and output the average, minimum, and maximum of those numbers to an output file. Take the name of the input file and output file from the user. Make sure to test for the conditions 1. if the count of numbers is less than 10 in the input file, then your average should reflect only for that many numbers 2. if the count of numbers is more than 10 in the input file, then your average should reflect only for ten numbers only.
Answer:
#include <iostream>
#include <climits>
#include<fstream>
using namespace std;
int main ()
{
fstream filein;
ofstream fileout;
string inputfilename, outputfilename;
// ASk user to enter filenames of input and output file
cout<<"Enter file input name: ";
cin>>inputfilename;
cout<<"Enter file output name: ";
cin>>outputfilename;
// Open both file
filein.open(inputfilename);
fileout.open(outputfilename);
// Check if file exists [Output file will automatically be created if not exists]
if(!filein)
{
cout<<"File cannot be opened"<<endl;
return 0;
}
int min = INT_MAX;
int max = INT_MIN; //(Can't use 0 or any other value in case input file has negative numbers)
int count = 0; // To keep track of number of integers read from file
double average = 0;
int number;
// Read number from file
while(filein>>number)
{
// If min > number, set min = number
if (min>number)
{
min = number;
}
// If max < number. set max = number
if(max<number)
{
max = number;
}
// add number to average
average = average+number;
// add 1 to count
count+=1;
// If count reaches 10, break the loop
if(count==10)
{
break;
}
}
// Calculate average
average = average/count;
// Write result in output file
fileout<<"Max: "<<max<<"\nMin: "<<min<<"\nAverage: "<<average;
// Close both files
filein.close();
fileout.close();
return 0;
}
Daniel owns a construction company that builds homes. To help his customers visualize the types of homes he can build for them, he designs five different models on the computer, using 3D printing to develop 3D paper models. What type of technology is Daniel using to develop these 3D models
Final answer:
Daniel is employing Computer-Aided Design (CAD) software and 3D printing to create 3D models for his construction company. This allows for detailed, precise visualizations and virtual tours of home designs, aiding clients in understanding the end product before building commences.
Explanation:
Daniel is using Computer-Aided Design (CAD) software coupled with 3D printing technology to develop the 3D models. CAD software allows users to create detailed, precise representations of products, buildings, and other projects, which then can be used to create physical models through 3D printing. This method is widely utilized in various industries, including construction, architecture, and product design to facilitate visualization and prototyping. The realistic representations and simulations provided by today's CAD programs help professionals like Daniel to effectively communicate design concepts to clients without the need for traditional physical mock-ups, enhancing the design process significantly.
Through this technology, Daniel can construct virtual tours offering exact views of the architectural designs. These models not only help in visualizing the structures but also in making more informed decisions on the design before any actual construction begins. Daniel's utilization of technology for creating 3-dimensional paper models demonstrates how contemporary architectural practices leverage digital tools to bring concepts to life for both the design teams and their clients.
Define a JavaScript function named showGrades which does not have any parameters. Your function should create and return an array containing 3 Numbers. The values for each of these entries should be: get the value from the div whose id is "GradeA" and store it at index 0 of your array; get the value from the div whose id is "Passing" and store it at index 1 of your array; and get the value from the div whose id is "Learning" and store it at index 2 of your array. Your must then encode the array as a JSON blob and return that JSON blob.
Answer:
see explaination
Explanation:
//selective dev elements by id name
var gradeA = document.querySelector("#GradeA");
var passing = document.querySelector("#Passing");
var learning = document.querySelector("#Learning");
//function showGrades
function showGrades() {
var arr = [];
//converting string to int and inserting into array
arr[0] = parseInt(gradeA.textContent);
arr[1] = parseInt(passing.textContent);
arr[2] = parseInt(learning.textContent);
//creating json blob
var blob = new Blob(new Array(arr), {type:"text/json"});
return blob;
}
SOLVE IN C:
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4:simonPattern: RRGBRYYBGYuserPattern: RRGBBRYBGYplease use comments to explain each step!! #include #include int main(void) { char simonPattern[50]; char userPattern[50]; int userScore; int i; userScore = 0; scanf("%s", simonPattern); scanf("%s", userPattern);**YOUR ANSWER GOES HERE** printf("userScore: %d\n", userScore); return 0;}
Answer:
#include <stdio.h>
#include <string.h>
int main(void) {
char simonPattern[50];
char userPattern[50];
int userScore;
int i;
userScore = 0;
scanf("%s", simonPattern);
scanf("%s", userPattern);
for(i = 0;simonPattern[i]!='\0';i++){
if(simonPattern[i]!=userPattern[i]){
userScore=i;
break;
}
}
printf("userScore: %d\n", userScore);
return 0;
}
Explanation:
Use a for loop that runs until it does not reach the end of simonPattern.Check whether the current index of simonPattern and userPattern are not equal and then assign the value of i variable to the userScore variable and break out of the loop.Finally display the user score.numbers that the user inputs. You must use JoptionPane to input the three numbers. A first method must be called and used to develop logic to find the smallest of the three numbers. A second method must be used to print out that smallest number found.
Input the three numbers. A first method must be called and used to develop logic to find the smallest of the three numbers. A second method must be used to print out that smallest number found.
Explanation:
Input of 3 numbers.Then the numbers are checked to print the smallest one.import java.util.Scanner;
public class Exercise1 {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input the first number: ");
double x = in.nextDouble();
System.out.print("Input the Second number: ");
double y = in.nextDouble();
System.out.print("Input the third number: ");
double z = in.nextDouble();
System.out.print("The smallest value is " + smallest(x, y, z)+"\n" );
}
public static double smallest(double x, double y, double z)
{
return Math.min(Math.min(x, y), z);
}
}
Create a class that holds data about a job applicant. Include a name, a phone number, and four Boolean fields that represent whether the applicant is skilled in each of the following areas: word processing, spreadsheets, databases, and graphics. Include a constructor that accepts values for each of the fields. Also include a get method for each field. Create an application that instantiates several job applicant objects and pass each in turn to a Boolean method that determines whether each applicant is qualified for an interview. Then, in the main() method, display an appropriate method for each applicant. A qualified applicant has at least three of the four skills. Save the files as JobApplicant.java and TestJobApplicants.java.
Answer:
Explanation:
I don't know about the answer in java.
This is what I did in C#. Find attached the answer
public class JobApplication
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string phoneNumber;
public string PhoneNumber
{
get { return phoneNumber; }
set { phoneNumber = value; }
}
private bool isSKilledInWordProcessing;
public bool IsSkilledInWordProcessing
{
get { return isSKilledInWordProcessing; }
set { isSKilledInWordProcessing = value; }
}
private bool isSkilledInSpreadsheets;
public bool IsSkilledInSpreadsheets
{
get { return isSkilledInSpreadsheets; }
set { isSkilledInSpreadsheets = value; }
}
private bool isSkilledInDatabases;
public bool IsSkilledInDatabases
{
get { return isSkilledInDatabases; }
set { isSkilledInDatabases = value; }
}
private bool isSkilledInGraphics;
public bool IsSkilledInGraphics
{
get { return isSkilledInGraphics; }
set { isSkilledInGraphics = value; }
}
public JobApplication(string name, string phoneNumber, bool isSKilledInWordProcessing,
bool isSkilledInSpreadsheets, bool isSkilledInDatabases, bool IsSkilledInGraphics)
{
Name = name;
PhoneNumber = phoneNumber;
IsSkilledInDatabases = isSkilledInDatabases;
IsSkilledInGraphics = isSkilledInGraphics;
IsSkilledInWordProcessing = IsSkilledInWordProcessing;
IsSkilledInSpreadsheets = isSkilledInSpreadsheets;
}
}
class Program
{
static void Main(string[] args)
{
JobApplication jobApplication1 = new JobApplication("Emmanuel Man", "+39399399", false, true, true, true);
CheckIfQualified(jobApplication1);
}
static void CheckIfQualified(JobApplication jobApplication)
{
if(jobApplication.IsSkilledInSpreadsheets && jobApplication.IsSkilledInGraphics
&& jobApplication.IsSkilledInWordProcessing && jobApplication.IsSkilledInDatabases)
{
Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");
} else if (jobApplication.IsSkilledInSpreadsheets && jobApplication.IsSkilledInGraphics
&& jobApplication.IsSkilledInWordProcessing)
{
Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");
}
else if (jobApplication.IsSkilledInSpreadsheets && jobApplication.IsSkilledInGraphics
&& jobApplication.IsSkilledInDatabases)
{
Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");
} else if (jobApplication.IsSkilledInWordProcessing && jobApplication.IsSkilledInGraphics
&& jobApplication.IsSkilledInDatabases)
{
Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");
}else if (jobApplication.IsSkilledInWordProcessing && jobApplication.IsSkilledInSpreadsheets
&& jobApplication.IsSkilledInDatabases)
{
Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");
}
else
{
Console.WriteLine("The applicant, " + jobApplication.Name + " is not qualified for the job");
}
}
}
Answer:
import java.util.Scanner;
public class TestJobApplicant{
public static void main(String[] args)
{
JobApplicant applicant1 = new JobApplicant("Ted","555-1234", true, false, false, false);
JobApplicant applicant2 = new JobApplicant("Lily", "655-1235", true, false, true, false);
JobApplicant applicant3 = new JobApplicant("Marshall", "755-1236", false, false, false, false);
JobApplicant applicant4 = new JobApplicant("Barney", "855-1237", true, true, true, false);
JobApplicant applicant5 = new JobApplicant("Robin", "955-1238", true, true, true, true);
String qualifiedMessage = "is qualified for an interview. ";
String notQualifiedMessage = "is not qualified for an interview at this time. ";
if (isQualified(applicant5))
display(applicant5, qualifiedMessage);
else
display(applicant5, notQualifiedMessage);
}
public static boolean isQualified(JobApplicant applicant) {
int count = 0;
boolean isQualified;
final int MIN_SKILLS = 3;
if(applicant.getWord())
count += 1;
if(applicant.getSpreadsheet())
count += 1;
if(applicant.getDatabase())
count += 1;
if(applicant.getGraphics())
count += 1;
if(count >= MIN_SKILLS)
isQualified = true;
else
isQualified = false;
return isQualified;
}
public static void display(JobApplicant applicant, String message) {
System.out.println(applicant.getName() + " " + message +" Phone: " + applicant.getPhone());
}
}
class JobApplicant {
private String name, phone;
private boolean word, spreadsheet, database, graphics;
public JobApplicant(String name, String phone, boolean word, boolean spreadsheet, boolean database, boolean graphics){
this.name = name;
this.phone = phone;
this.word = word;
this.spreadsheet = spreadsheet;
this.database = database;
this.graphics = graphics;
}
public String getName() {return name;}
public String getPhone() {return phone;}
public boolean getWord() {return word;}
public boolean getSpreadsheet() {return spreadsheet;}
public boolean getDatabase() {return database;}
public boolean getGraphics() {return graphics;}
}
Explanation:
Inside the JobApplicant class:
- Declare the variables
- Initialize the constructor
- Create the get methods for each variable
Inside the TestJobApplicant class:
- Create an isQualified method that checks if given applicant is qualified for the job.
- Create a display method that prints the name, message and phone number for the applicant
Inside the main:
- Initialize the applicant objects and messages
- Call the isQualified method with an applicant to see the result
JAVA PROGRAMMING
Arrays are useful to process lists.
A top-level domain (TLD) name is the last part of an Internet domain name like .com in example.com. A core generic top-level domain (core gTLD) is a TLD that is either .com, .net, .org, or .info. A restricted top-level domain is a TLD that is either .biz, .name, or .pro. A second-level domain is a single name that precedes a TLD as in apple in apple.com.
The following program repeatedly prompts for a domain name, and indicates whether that domain name consists of a second-level domain followed by a core gTLD. Valid core gTLD's are stored in an array. For this program, a valid domain name must contain only one period, such as apple.com, but not support.apple.com. The program ends when the user presses just the Enter key in response to a prompt.
1-Run the program and enter domain names to validate.
2-Extend the program to also recognize restricted TLDs using an array, and statements to validate against that array. The program should also report whether the TLD is a core gTLD or a restricted gTLD. Run the program again.
import java.util.Scanner;
public class GtldValidation {
public static void main (String [ ] args) {
Scanner scnr = new Scanner(System.in);
// Define the list of valid core gTLDs
String [ ] validCoreGtld = { ".com", ".net", ".org", ".info" };
// FIXME: Define an array named validRestrictedGtld that has the names
// of the restricted domains, .biz, .name, and .pro
String inputName = "";
String searchName = "";
String theGtld = "";
boolean isValidDomainName = false;
boolean isCoreGtld = false;
boolean isRestrictedGtld = false;
int periodCounter = 0;
int periodPosition = 0;
int i = 0;
System.out.println("\nEnter the next domain name ( to exit): ");
inputName = scnr.nextLine();
while (inputName.length() > 0) {
searchName = inputName.toLowerCase();
isValidDomainName = false;
isCoreGtld = false;
isRestrictedGtld = false;
// Count the number of periods in the domain name
periodCounter = 0;
for (i = 0; i < searchName.length(); ++i) {
if (searchName.charAt(i) == '.') {
++periodCounter;
periodPosition = i;
}
}
// If there is exactly one period that is not at the start
// or end of searchName, check if the TLD is a core gTLD or a restricted gTLD
if ((periodCounter == 1) &&
(searchName.charAt(0) != '.') &&
(searchName.charAt(searchName.length() - 1) != '.')) {
isValidDomainName = true;
}
if (isValidDomainName) {
// Extract the Top-level Domain name starting at the period's position. Ex:
// If searchName = "example.com", the next statement extracts ".com"
theGtld = searchName.substring(periodPosition);
i = 0;
while ((i < validCoreGtld.length) && (!isCoreGtld)) {
if(theGtld.equals(validCoreGtld[i])) {
isCoreGtld = true;
}
else {
++i;
}
}
// FIXME: Check to see if the gTLD is not a core gTLD. If it is not,
// check to see whether the gTLD is a valid restricted gTLD.
// If it is, set isRestrictedGtld to true
}
System.out.print("\"" + inputName + "\" ");
if (isValidDomainName) {
System.out.print("is a valid domain name and ");
if (isCoreGtld) {
System.out.println("has a core gTLD of \"" + theGtld + "\".");
}
else if (isRestrictedGtld) {
System.out.println("has a restricted gTLD of \"" + theGtld + "\".");
}
else {
System.out.println("does not have a core gTLD."); // FIXME update message
}
}
else {
System.out.println("is not a valid domain name.");
}
System.out.println("\nEnter the next domain name ( to exit): ");
inputName = scnr.nextLine();
}
return;
}
}
Answer:
See explaination
Explanation:
import java.util.Scanner;
public class GtldValidation {
public static void main (String [ ] args) {
Scanner scnr = new Scanner(System.in);
// Define the list of valid core gTLDs
String [ ] validCoreGtld = { ".com", ".net", ".org", ".info" };
// FIXME: Define an array named validRestrictedGtld that has the names
// of the restricted domains, .biz, .name, and .pro
String [] validRestrictedGtld={".biz",".name",".pro"};
String inputName = "";
String searchName = "";
String theGtld = "";
boolean isValidDomainName = false;
boolean isCoreGtld = false;
boolean isRestrictedGtld = false;
int periodCounter = 0;
int periodPosition = 0;
int i = 0;
System.out.println("\nEnter the next domain name (<Enter> to exit): ");
inputName = scnr.nextLine();
while (inputName.length() > 0) {
searchName = inputName.toLowerCase();
isValidDomainName = false;
isCoreGtld = false;
isRestrictedGtld = false;
// Count the number of periods in the domain name
periodCounter = 0;
for (i = 0; i < searchName.length(); ++i) {
if (searchName.charAt(i) == '.') {
++periodCounter;
periodPosition = i;
}
}
// If there is exactly one period that is not at the start
// or end of searchName, check if the TLD is a core gTLD or a restricted gTLD
if ((periodCounter == 1) &&
(searchName.charAt(0) != '.') &&
(searchName.charAt(searchName.length() - 1) != '.')) {
isValidDomainName = true;
}
if (isValidDomainName) {
// Extract the Top-level Domain name starting at the period's position. Ex:
// If searchName = "example.com", the next statement extracts ".com"
theGtld = searchName.substring(periodPosition);
i = 0;
while ((i < validCoreGtld.length) && (!isCoreGtld)) {
if(theGtld.equals(validCoreGtld[i])) {
isCoreGtld = true;
}
else {
++i;
}
}
// FIXME: Check to see if the gTLD is not a core gTLD. If it is not,
// check to see whether the gTLD is a valid restricted gTLD.
// If it is, set isRestrictedGtld to true
}
System.out.print("\"" + inputName + "\" ");
if (isValidDomainName) {
System.out.print("is a valid domain name and ");
if (isCoreGtld) {
System.out.println("has a core gTLD of \"" + theGtld + "\".");
}
else if (isRestrictedGtld) {
System.out.println("has a restricted gTLD of \"" + theGtld + "\".");
}
else {
System.out.println("does not have a core gTLD."); // FIXME update message
}
}
else {
System.out.println("is not a valid domain name.");
}
System.out.println("\nEnter the next domain name (<Enter> to exit): ");
inputName = scnr.nextLine();
}
return;
}
}
Write a program that will create an array of Employees and calculate their weekly salary. For the employee structure you need to store eid, name, address, hourly Rate, total Hours, bonus, and, salary. You need to ask the user for the number of employees in the company. Then create an array of Employee structure of that size. Next, take details of all employees by creating a user-defined function named readEmployee. Next, compute the weekly salary of each employee and finally print into the output. Create two more user-define functions named Compute Salary and PrintEmployee to generate gross salary and print employee details into output. You have to store the result into a text file named EmployeeSalary.txt as well. [Note: You have to use Structure and File I/O. Use pointers wherever necessary.]
Answer:
See explaination
Explanation:
#include <stdio.h>
#include <malloc.h>
typedef struct {
int eid;
char name[30];
char address[50];
float hourlyRate;
int totalHours;
float bonus;
float salary;
}employee;
void readEmployee(employee *employees, int size){
int i;
for(i = 0; i < size; ++i){
printf("Enter details of employee %d\n", i + 1);
printf("Enter eid: ");
scanf("%d", &employees[i].eid);
printf("Enter name: ");
scanf("%s", employees[i].name);
printf("Enter address: ");
scanf("%s", employees[i].address);
printf("Enter hourly rate: ");
scanf("%f", &employees[i].hourlyRate);
printf("Enter total hours: ");
scanf("%d", &employees[i].totalHours);
printf("Enter bonus percentage: ");
scanf("%f", &employees[i].bonus);
}
}
void ComputeSalary(employee *employees, int size){
int i;
for(i = 0; i < size; ++i){
employees[i].salary = (1 + (employees[i].bonus / 100.0)) * employees[i].hourlyRate * employees[i].totalHours;
}
}
void PrintEmployee(employee *employees, int size){
int i;
for(i = 0; i < size; ++i){
printf("Employee %d\n", i + 1);
printf("Eid: %d\n", employees[i].eid);
printf("Name: %s\n", employees[i].name);
printf("Address: %s\n", employees[i].address);
printf("Total hours: %d\n", employees[i].totalHours);
printf("Hourly rate: $%.2f\n", employees[i].hourlyRate);
printf("Bonus: %.2f%%\n", employees[i].bonus);
printf("Salary: $%.2f\n", employees[i].salary);
}
}
int main(){
int i, size;
employee *employees;
printf("Enter number of employees: ");
scanf("%d", &size);
employees = (employee *) malloc(sizeof(employee) * size);
readEmployee(employees, size);
ComputeSalary(employees, size);
PrintEmployee(employees, size);
return 0;
}
Please construct a program that reads the content from the file numbers.txt. There are two lines in the file, each is an integer number. Print out the two numbers and their sum in an equation as below: Content in numbers.txt: 45 28 Output of the program: 45 28
Answer:
file = open("numbers.txt")
numbers = []
for line in file:
numbers.append(int(line))
print("The numbers in the file: " + str(numbers[0]) + " " + str(numbers[1]))
print("The sum of the numbers: " + str(numbers[0] + numbers[1]))
Explanation:
The code is in Python.
Open the file named numbers.txt
Create an empty list, numbers, to hold the numbers in the file
Create a for loop that iterates through file and adds the number inside the file to the list
Print numbers
Calculate and print the sum of the numbers
Final answer:
To read two integers from a file and print their sum, use a Python script to open the file, convert the strings to integers, calculate the sum, and print the results with the equation format.
Explanation:
To construct a program that reads the content from the file numbers.txt and prints out the two numbers along with their sum, you would need to use a programming language. Below is an example of how you might write such a program in Python:
with open('numbers.txt', 'r') as file:
numbers = file.read().splitlines()
num1 = int(numbers[0])
num2 = int(numbers[1])
sum_of_numbers = num1 + num2
print(f"{num1} + {num2} = {sum_of_numbers}")
This program opens the file numbers.txt, reads its content line by line, converts the lines to integers, and then calculates their sum. Finally, it prints out the numbers and the sum in the format specified. It is assumed that numbers.txt contains one number per line and that these can be converted directly to integers.
What output will be produced by the following code?
public class SelectionStatements { public static void main(String[] args)
{ int number = 25; if(number % 2 == 0)
System.out.print("The condition evaluated to true!");
else
System.out.print("The condition evaluated to false!"); } }
Answer:
The condition evaluated to false!
Explanation:
lets attach line numbers to the given code snippet
public class SelectionStatements { public static void main(String[] args) { int number = 25; if(number % 2 == 0) System.out.print("The condition evaluated to true!"); else System.out.print("The condition evaluated to false!"); } }In Line 3: An integer number is declared and assigned the value 25Line 4 uses the modulo operator (%) to check if the number (25) is evenly divided by 2. This however is not true, so line 5 is not executedThe else statement on line 6- 7 gets executedConsider the following line of code: if (x < 12 || (r – 3 > 12)) Write three valid mutants of this ground string (based on the rules of the Java/C# language), followed by three invalid mutants. You must use a different mutant operator for each mutant you create – list the abbreviation for the operator used next to each line (for example, write "ROR" if you used a Relational Operator Replacement).
Answer:
See explaination
Explanation:
Mutation Testing:
Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors. It is a type of White Box Testing which is mainly used for Unit Testing. The changes in the mutant program are kept extremely small, so it does not affect the overall objective of the program.
We say a mutant is valid if it is syntactically correct. We say a mutant is useful if, in addition to being valid, its behavior differs from the behavior of the original program for no more than a small subset of program test cases.
VALID MUTANTS
1. if (x < 12 && (r – 3 > 12)) LOR
2. if (x < 12 || (r – 3 < 12)) ROR
3. if (x < 12 || (x – 3 < 12)) IVR
INVALID MUTANTS
1. if (x < 12 ||(r – 3 > 12) UPR
2. if (x < 12 (r – 3 < 12)) MLO
3. (x < 12 || (x – 3 < 12)) CSM
Note:
LOR: LOGICAL OPERATOR REPLACEMENT
ROR: RELATIONAL OPERATOR REPLACEMENT
IVR: INVALID VARIABLE REPLACEMENT
UPR: UNBALENCED PARANTHISIS REPLACEMENT
MLO: MISSING LOGICAL OPERATOR REPLACEMENT
CSM: CONTROL OPERATOR MISSING REPLACEMEN
What is the purpose of a Program Epic?
Answer:
An Epic is a container for a Solution development initiative large enough to require analysis, the definition of a Minimum Viable Product (MVP), and financial approval prior to implementation. Implementation occurs over multiple Program Increments (PIs) and follows the Lean startup 'build-measure-learn' cycle.
Explanation:
Hope this is what your looking for
The purpose of a Program Epic is to represent business capabilities that address various user needs.
What is Program Epic ?
An Epic is a holder for a Solution improvement drive sufficiently enormous to require examination, the meaning of a Minimum Viable Product (MVP), and monetary endorsement preceding execution. Execution happens over numerous Program Increments (PIs) and follows the Lean startup 'assemble measure-learn' cycle.
A program epic obliged to a solitary delivery train, conveyed by different groups, and crossing numerous PI emphases. Program Epics can address business abilities that address different client needs. Include: Functionality that meets explicit partner needs.
Thus, the purpose is explained.
Learn more about Program Epic
https://brainly.com/question/15450565
#SPJ2
8.17 Lab: Strings of a Frequency Write a program that reads whitespace delimited strings (words) and an integer (freq). Then, the program outputs the strings from words that have a frequency equal to freq in a case insensitive manner.
The program reads whitespace-delimited strings and an integer frequency, then outputs strings with the specified frequency in a case-insensitive manner using a frequency counting approach.
In this programming task, the goal is to create a program that reads whitespace-delimited strings and an integer frequency (freq). The program should then output the strings from the input that have a frequency equal to the specified freq in a case-insensitive manner.
To achieve this, the program needs to:
1. Read input: Use an input mechanism to read whitespace-delimited strings and the integer frequency.
2. Count frequency: Maintain a data structure, such as a dictionary or a hashmap, to store the frequency of each string. While reading the input strings, update the frequency count accordingly.
3. Filter strings: Iterate through the stored strings and output only those with a frequency equal to the specified freq. Ensure case-insensitivity by converting all strings to lowercase during comparison.
Here's a Python example:
```python
def find_strings_with_frequency(words, freq):
word_count = {}
# Count the frequency of each word
for word in words:
word_lower = word.lower()
word_count[word_lower] = word_count.get(word_lower, 0) + 1
# Output strings with the specified frequency
result = [word for word, count in word_count.items() if count == freq]
return result
# Example usage
input_words = input("Enter whitespace-delimited strings: ").split()
input_freq = int(input("Enter frequency: "))
output_strings = find_strings_with_frequency(input_words, input_freq)
print("Strings with frequency {}: {}".format(input_freq, output_strings))
```
This program takes user input for whitespace-delimited strings and an integer frequency, processes the input, and outputs strings with the specified frequency in a case-insensitive manner.
Write a program that converts a temperature from Celsius to Fahrenheit. It should (1) prompt the user for input, (2) read a double value from the keyboard, (3) calculate the result, and (4) format the output to one decimal place. For example, it should display "24.0 C = 75.2 F". Here is the formula. Be careful not to use integer division! F = C × 9 5 + 32
Answer:
celsius = float(input("Enter the celcius value: "))
f = 1.8 * celsius + 32
print(str(celsius) + " C = "+ str(f) + " F")
Explanation:
The code is in Python.
Ask the user for the input, celsius value
Convert the celsius value to fahrenheit using the given formula
Print the result as in shown in the example output
Answer:
See explaination
Explanation:
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
double tempF, tempC;
cout<<"Enter a degree in Celsius: ";
cin>>tempC;
tempF = tempC*(9/5.0)+32;
cout<<setprecision(1)<<fixed;
cout<<tempC<<" C = "<<tempF<<" F"<<endl;
return 0;
}
Purchasing services from a cloud provider has many advantages, as was discussed in Section 7.5. However, the cloud can also create problems with regard to your business or research environment. For each of the following areas, discuss problems that could occur when you purchase cloud services to handle your company's data storage backup.
a. Internet outages
b. Data security
c. Data inflexibility
d. Customer support
Answer:
See explaination
Explanation:
Kindly check the attachment for the details
The WorkOrders table contains a foreign key, ClientNum, which must match the primary key of the Client table. What type of update to the WorkOrders table would violate referential integrity? If deletes do not cascade, what type of update to the Client table would violate referential integrity? If deletes do cascade, what would happen when a client was deleted?
Answer:
Changing the customer number on a record in the Orders table to a number that does not match a customer number in the customer table would violate referential integrity.
If deletes do not cascade, deleting a customer that has orders would violate referential integrity.
If deletes cascade, customer can be deleted and all orders for that customer will automatically be deleted.
Provided below is the implementation of the hashtable data structure we went over together in class. You are to implement the rehash method, which will be called with a new size for the internal buckets array. rehash will create a new buckets array, copy all the key/value pairs from the old buckets array into the new one, using linked list chains as before to support collisions, then switch to using the new buckets array. rehash should run in O(N) time, where N is the number of key/value pairs,. Your implementation of rehash should not make use of any other hashtable or list methods (other than those demonstrated in __setitem__ and __getitem__). Note that the first and last lines of rehash are given; you should not alter them.
Answer:
numBuckets = 47
def create():
global numBuckets
hSet = []
for i in range(numBuckets):
hSet.append([])
# print "[XYZ]: create() hSet: ", hSet, " type(hSet): ",type(hSet)
return hSet
def hashElem(e):
global numBuckets
return e % numBuckets
def insert(hSet,i):
hSet[hashElem(i)].append(i)
# print "[XYZ]: insert() hSet: ", hSet, " type(hSet): ",type(hSet)
def remove(hSet,i):
newBucket = []
for j in hSet[hashElem(i)]:
if j != i:
newBucket.append(j)
hSet[hashElem(i)] = newBucket
print "[XYZ]: remove() i: ", i," hashElem[i]: ", hashElem(i), " hSet[hashElem(i): ", hSet[hashElem(i)]
def member(hSet,i):
return i in hSet[hashElem(i)]
def testOne():
s = create()
for i in range(40):
insert(s,i)
print "[XYZ]: S: ", s
insert(s,325)
insert(s,325)
insert(s,9898900067)
print "[XYZ]: S: ", s
print "[XYZ]: ,member(s,325): ",member(s,325)
remove(s,325)
print "[XYZ]: After Remove, member(s,325): ",member(s,325)
print "[XYZ]: member(s,9898900067)",member(s,9898900067)
testOne()