Answer:
to make a spread sheet and to make sure you have all of the sum and didn[t miss a number
Explanation:
This is to be done in java
Task 1: Write a car class - this is a prototype or blueprint for many different cars that will follow the same basic type of pattern. Your car class should have 4 fields that describe characteristics of a car including model, make, year, color, speed, velocity.
Possible values for each field:
Model: Wrangler, Grand Cherokee, Camry, Corolla, Corvette, Bolt
Make: Jeep, Toyota, Chevrolet
Year: 1946, 2022
Color: red, blue, silver
Speed: 25, 25, 55, 75,100
Task 2: Your car class should also have several methods - assuming it has a rider to do them, the car can have certain behaviors or actions that it can take. Add the methods to accomplish the following:
Set a speed (could take an integer in mph)
Calculate a speed (could take a distance in miles and a time in hours)
Get a speed (in mph)
Task 3: Create a constructor that takes four parameters for your car class and initializes speed to 0.
Write a main method and inside it, invoke a new car object for every person at your table. Print a complete ‘description’ of each car to the console using the System.out.println and toString methods. Each car should be unique, so be creative with the color choice.
Task 4: Agree on the value of and create a speedLimit field for your car class and create two public methods to get and change the value of the speed limit.
Task 5: Draw the UML representation of the class that you have created.
IndividualTask 6: Create a class method that is named isSpeeding that takes as arguments a distance in miles, a time in hours and a Car to determine whether the car is speeding. Ask your colleges how fast they want to go to the beach and determine whether they would be speeding. Assume the beach is 330 miles away.
IndividualTask 7: Draw the UML Diagram for your class.
Please respond ASAP
Using the knowledge in computational language in python it is possible to write a code that write a car class - this is a prototype or blueprint for many different cars that will follow the same basic type of pattern.
Writting the code:public class Car {
private String model, make, color;
private int year, speed, speedLimit;
public void setSpeed(int speed) { this.speed = speed; }
public int calculateSpeed(int miles, int hours) {
return (int)(Double.valueOf(miles) / hours);
}
public int getSpeed() { return speed; }
public Car(String model, String make, String color, int year) {
this.model = model;
this.make = make;
this.color = color;
this.year = year;
this.speed = 0;
this.speedLimit = 35;
}
// method that returns a string representation of the object
public String toString() {
return "Model: " + model + ", Make: " + make + ", Color: " + color +
", Year: " + year + ", Speed: " + speed + " mph";
}
// method to get the value of speed limit
public int getSpeedLimit() { return speedLimit; }
// method to change the value of speed limit
public void setSpeedLimit(int limit) { speedLimit = limit; }
public boolean isSpeeding(int miles, int hours) {
int carSpeed = calculateSpeed(miles, hours);
if(carSpeed > speedLimit)
return true;
else
return false;
}
}
See more about JAVA at brainly.com/question/18502436
#SPJ1
what is the abbreviation of IP address
Answer: Internet Protocol Address
Explanation: IP Address is the abbreviation of Internet Protocol Address
Hope this helps
--Wavey
the meaning of the abbreviation of IP address is: Internet Protocol address(IP address)
sorry if that isn't what you meant, but hope this helps
“What is an example of the vocabulary word foreshadow?” This question could be a
a.
Potential question
c.
Flashcards question
b.
Vocabulary definition
d.
Both A and C
Please select the best answer from the choices provided
A
B
C
D
Answer:
D) Both A and C
Explanation:
Answer:
D
Explanation:
Described FOUR (4) issues that possibly raised when the organization does
not emphasize the code of ethics concerning to the software engineering
issues?
Explanation:
1- Information theft: One of the problems that can arise when an organization does not develop an efficient code of ethics regarding software engineering is the use of confidential information for its own benefit or for the benefit of third parties.
2- Access to confidential information: An organization has private information that can only be accessed by the top hierarchy, such as management decisions, performance indexes, etc. Therefore, an unethical attitude would be a software engineer to access such information and have access to information. confidential.
3- Intrapersonal conflicts: It is possible that there is hacker interference in an organization to harm some team or collaborator, exposing facts and rumors for the generation of conflicts and exposure.
4- Asset theft: Accessing some system vulnerabilities, it is possible to access the organization's bank accounts by stealing financial assets without leaving a trace.
Help asap PLEASE IM STUCK
To sort the filtered data first alphabetically by the values in the Model column and then by icon in the Cmb MPG Icon column so the Signal Meter With Four Filled Bars icon appears at the top, you can follow these steps:
What are the steps!Select the filtered data.
Click on the "Data" tab in the ribbon.
Click on the "Sort" button in the "Sort & Filter" group.
In the "Sort" dialog box, select "Model" from the "Column" dropdown list and select "A to Z" from the "Order" dropdown list.
Click on the "Add Level" button.
In the "Sort" dialog box, select "Cmb MPG Icon" from the "Column" dropdown list and select "Custom List" from the "Order" dropdown list.
In the "Custom Lists" dialog box, select "Signal Meter With Four Filled Bars" from the list and click on the "Add" button.
Click on the "OK" button in the "Custom Lists" dialog box.
Select "Signal Meter With Four Filled Bars" from the "Order" dropdown list.
Click on the "OK" button in the "Sort" dialog box.
To add subtotals for each change in Model to calculate the average for the Air Pollution Score, City MPG, Hwy MPG, and Cmb MPG, you can follow these steps:
Go to the top of the My Car Data worksheet.
Select the data range.
Click on the "Data" tab in the ribbon.
Click on the "Subtotal" button in the "Outline" group.
In the "Subtotal" dialog box, select "Model" from the "At each change in" dropdown list.
Select the checkboxes for "Air Pollution Score", "City MPG", "Hwy MPG", and "Cmb MPG".
Select "Average" from the "Use function" dropdown list..
Click on the "OK" button.
To collapse the data to show just the total rows, you can click on the "2" button above the row numbers on the left-hand side of the worksheet.
To refresh the PivotTable data on the MPG PivotTable worksheet, you can follow these steps:
Click anywhere in the PivotTable.
Click on the "Analyze" tab in the ribbon.
Click on the "Refresh" button in the "Data" group.
To apply the Pivot Style Medium 1 Quick Style to the PivotTable and display a slicer for the SmartWay field and show only data where the SmartWay value is Elite, you can follow these steps:
Click anywhere in the PivotTable.
Click on the "Design" tab in the ribbon.
Click on the "PivotTable Styles" button in the "PivotTable Styles" group.
Select "Medium 1" from the list of Quick Styles.
Click on the "Insert Slicer" button in the "Filter" group.
Select "SmartWay" from the list of fields.
Select "Elite" from the list of values.
Click on the "OK" button.
Learn more about data on;
https://brainly.com/question/26711803
#SPJ1
Declare an array to store objects of the class defined by the UML. Use a method from the JOptionPane class to request the length of the array from the user.
Answer:
it's a test ?
The showInputDialog method is a part of the JOptionPane class in Java Swing, which provides a set of pre-built dialog boxes for displaying messages and obtaining user input.
Here's an example of how you can declare an array to store objects of a class, and use a method from the JOptionPane class to request the length of the array from the user:
import javax.swing.JOptionPane;
public class MyClass {
// Define your class according to the UML
public static void main(String[] args) {
// Request the length of the array from the user using JOptionPane
String lengthInput = JOptionPane.showInputDialog("Enter the length of the array:");
// Parse the user input to an integer
int arrayLength = Integer.parseInt(lengthInput);
// Declare the array to store objects of the class
MyClass[] myArray = new MyClass[arrayLength];
// Now you have an array of the desired length to store objects of your class
// You can proceed to instantiate objects and store them in the array
}
}
In this example, we use the showInputDialog method from the JOptionPane class to display an input dialog box and prompt the user to enter the desired length of the array. The user's input is then parsed into an integer using Integer.parseInt() and stored in the arrayLength variable.
Therefore, an array myArray of type MyClass is declared with the specified length, ready to store objects of the MyClass class.
For more details regarding the showInputDialog method, visit:
https://brainly.com/question/32146568
#SPJ2
How can an organization customize and extend the functionality of a platform?
To tailor and enhance the features of a system, a company can employ these procedures:
The ProceduresIntelligently pinpoint the exact needs and preferred functionalities that necessitate adaptation or expansion.
Evaluate the platform's potential for customization, including assessing its APIs, plugins, and development frameworks.
Create tailored code or integrations in order to enhance current features or introduce novel functionalities.
Thoroughly test the customizations to verify that they function as expected.
Implement the tailored platform in a regulated setting.
Consistently observe and sustain the modifications, resolving any glitches or suitability problems that surface.
Keep yourself informed about the latest platform updates and releases to ensure compatibility and take advantage of new features.
For intricate customizations, it is advisable to request aid from platform vendors or developers.
Read more about functionality here:
https://brainly.com/question/30463047
#SPJ1
Expectations in ICT as a student
Expectations in ICT as a student are: Information and communication technologies (ICTs) are an essential part of daily life for students who live in a technologically advanced society. ICTs are made up of the digital systems, peripheral equipment, software, and hardware that make it possible to manage, store, process, and exchange data and information.
What are the Expectations in ICT as a student?You can increase the effectiveness of data management and processing by learning the necessary programming languages through ICT studies. Students will learn about essential tools, ranging from straightforward applications like Microsoft Excel to more specialized, analytical platforms like ZAP.
Note that ICT strand courses aim to impart information technology knowledge and skills to students. Students will learn how to create programs and webpages as part of the ICT curriculum.
Additionally, this will enable students to improve their animation and illustration abilities, which will help them succeed in creativity.
Learn more about information technology from
https://brainly.com/question/25110079
#SPJ1
Under foreign corrupt practices act, under what conditions is a bribe not unlawful explain and provide an example
Answer:
ex. telling your children if you clean up you get new toys
Can someone help me with the following logical circuit, perform two actions. FIRST, convert the circuit into a logical
statement. SECOND, create a truth table based on the circuit/statement. (20 pts. each for statement and
truth table.
Creation of Truth Table Based on the logical statement, we can create a truth table as shown below:
A B (not A) (not A) and B (not A) and B or A A or (not A) and B 0 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1
The first two columns show the input values, the next column shows the output of the NOT gate, then the output of the AND gate, then the output of the OR gate and finally the output of the logical statement.
We can observe that the output of the logical statement is the same as the output of the OR gate.
Given the logical circuit, we are required to perform two actions on it. Firstly, convert the circuit into a logical statement. Secondly, create a truth table based on the circuit/statement. Let's understand how to do these actions one by one:Conversion of Circuit into Logical Statement.
The given circuit contains three components: NOT gate, AND gate and OR gate. Let's analyze the working of this circuit. The two input variables A and B are first passed through the NOT gate, which gives the opposite of the input signal.
Then the NOT gate output is passed through the AND gate along with the input variable B. The output of the AND gate is then passed through the OR gate along with the input variable A.We can create a logical statement based on this working as: (not A) and B or A. This can also be represented as A or (not A) and B. Either of these statements is correct and can be used to construct the truth table.
Creation of Truth Table Based on the logical statement, we can create a truth table as shown below:
A B (not A) (not A) and B (not A) and B or A A or (not A) and B 0 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1
In the truth table, we have all possible combinations of input variables A and B and their corresponding outputs for each component of the circuit.
The first two columns show the input values, the next column shows the output of the NOT gate, then the output of the AND gate, then the output of the OR gate and finally the output of the logical statement.
We can observe that the output of the logical statement is the same as the output of the OR gate.
For more such questions on Truth Table, click on:
https://brainly.com/question/13425324
#SPJ8
If you create a notebook for this semester's schedule with a separate part for each course, you should divide your notebook into one __________ for each course.
If you create a notebook for this semester's schedule with a separate part for each course, you should divide your notebook into one SECTION for each course. It helps to organize tasks.
Notebooks and sectionsA section is a specific page/s in the notebooks, which may contain different types of information.
In a notebook, each section can be defined as a set of related (associated) pages, which can help to organize tasks.
A notebook can be divided into the amount sections as is desired, and each section may have a different number of pages.
Learn more about notebooks and sections here:
https://brainly.com/question/13989073
Bro how the hell do u do full screen on windows
(LAPTOP. NOT PC.)
f11 does not work, does anyone have a solution?
Answer:
You'll need to hold down/click f11 and fn at the same time.
If not that, try ctrl + shift + f5.
I can guarantee the first works; not too sure about the second.
Explanation:
Well, it's hotkeys, so...
EDIT: The f5 command does nothing related to full screen, my bad.
Answer:
f11 should work just hold it down or restart your computer and try it again
Explanation:
Algorithm:
Suppose we have n jobs with priority p1,…,pn and duration d1,…,dn as well as n machines with capacities c1,…,cn.
We want to find a bijection between jobs and machines. Now, we consider a job inefficiently paired, if the capacity of the machine its paired with is lower than the duration of the job itself.
We want to build an algorithm that finds such a bijection such that the sum of the priorities of jobs that are inefficiently paired is minimized.
The algorithm should be O(nlogn)
My ideas so far:
1. Sort machines by capacity O(nlogn)
2. Sort jobs by priority O(nlogn)
3. Going through the stack of jobs one by one (highest priority first): Use binary search (O(logn)) to find the machine with smallest capacity bigger than the jobs duration (if there is one). If there is none, assign the lowest capacity machine, therefore pairing the job inefficiently.
Now my problem is what data structure I can use to delete the machine capacity from the ordered list of capacities in O(logn) while preserving the order of capacities.
Your help would be much appreciated!
To solve the problem efficiently, you can use a min-heap data structure to store the machine capacities.
Here's the algorithm:Sort the jobs by priority in descending order using a comparison-based sorting algorithm, which takes O(nlogn) time.
Sort the machines by capacity in ascending order using a comparison-based sorting algorithm, which also takes O(nlogn) time.
Initialize an empty min-heap to store the machine capacities.
Iterate through the sorted jobs in descending order of priority:
Pop the smallest capacity machine from the min-heap.
If the machine's capacity is greater than or equal to the duration of the current job, pair the job with the machine.
Otherwise, pair the job with the machine having the lowest capacity, which results in an inefficient pairing.
Add the capacity of the inefficiently paired machine back to the min-heap.
Return the total sum of priorities for inefficiently paired jobs.
This algorithm has a time complexity of O(nlogn) since the sorting steps dominate the overall time complexity. The min-heap operations take O(logn) time, resulting in a concise and efficient solution.
Read more about algorithm here:
https://brainly.com/question/13902805
#SPJ1
Solve the following linear program graphically (each line represents one unit). The feasible region is indicated by the shading and the corner points have been listed for you. Determine the objective function value at the corner points and indicate the optimal solution (if any). Minimize: Z
Answer:
(a): The value of the objective function at the corner points
\(Z = 10\)
\(Z = 19\)
\(Z = 15\)
(b) The optimal solution is \((6,2)\)
Explanation:
Given
\(Min\ Z = X_1 + 2X_2\)
Subject to:
\(-2X_1 + 5X_2 \ge -2\) ---- 1
\(X_1 + 4X_2 \le 27\) ---- 2
\(8X_1 + 5X_2 \ge 58\) --- 3
Solving (a): The value of the at the corner points
From the graph, the corner points are:
\((6,2)\ \ \ \ \ \ (11,4)\ \ \ \ \ \ \ \ (3,6)\)
So, we have:
\((6,2)\) ------- Corner point 1
\(Min\ Z = X_1 + 2X_2\)
\(Z = 6 + 2 * 2\)
\(Z = 6 + 4\)
\(Z = 10\)
\((11,4)\) ------ Corner point 2
\(Min\ Z = X_1 + 2X_2\)
\(Z = 11 + 2 * 4\)
\(Z = 11 + 8\)
\(Z = 19\)
\((3,6)\) --- Corner point 3
\(Min\ Z = X_1 + 2X_2\)
\(Z = 3 + 2 * 6\)
\(Z = 3 + 12\)
\(Z = 15\)
Solving (b): The optimal solution
Since we are to minimize Z, the optimal solution is at the corner point that gives the least value
In (a), the least value of Z is: \(Z = 10\)
So, the optimal solution is at: corner point 1
\((6,2)\)
Determine z1
, z2
, and z3
in the following:
a) P(Z≤z1)=0.8413
b) P(Z≥z2)=0.025
c) P(−1≤Z≤z3)=0.75
What is the name of the windows os from August 27, 2013 and considered one of the greatest OS'S?
Answer:
windows 8.1
Explanation:
Which sensitivity level is not a default available in Outlook 2016?
Normal
Personal
Confidential
Company Only
Answer:
Company only
Explanation: The sensitivity levels available for Outlook 2016 are Normal, personal,private and confidential, this sensitivity levels helps users to the intentions of the user of the product and it will help to give their plan on what and how to utilize the product. It is very important to make use of the sensitivity levels in your Outlook for better usage of the Microsoft Outlook.
Answer:
company only
Explanation:
because i took the test edge2020
To make a window wider, you would move the pointer until it changes to the horizontal resize shape and then
Answer:double click it .
Explanation:
Which core business etiquette is missing in Jane
Answer:
As the question does not provide any context about who Jane is and what she has done, I cannot provide a specific answer about which core business etiquette is missing in Jane. However, in general, some of the key core business etiquettes that are important to follow in a professional setting include:
Punctuality: Arriving on time for meetings and appointments is a sign of respect for others and their time.
Professionalism: Maintaining a professional demeanor, dressing appropriately, and using appropriate language and tone of voice are important in projecting a positive image and establishing credibility.
Communication: Effective communication skills such as active listening, clear speaking, and appropriate use of technology are essential for building relationships and achieving business goals.
Respect: Treating others with respect, including acknowledging their opinions and perspectives, is key to building positive relationships and fostering a positive work environment.
Business etiquette: Familiarity with and adherence to appropriate business etiquette, such as proper introductions, handshakes, and business card exchanges, can help establish a positive first impression and build relationships.
It is important to note that specific business etiquettes may vary depending on the cultural and social norms of the particular workplace or industry.
Write a class called DisArray with methods to convert a 1-dimensional array to a 2-dimensional array. The methods' name should be convert2D. You should create methods to convert int[] and String[], that can be tested against the following class. Your convert2D methods should choose the closest possible square-ish size for the 2D array. For example, if your input array is [10], its 2D conversion should be [3][4] or [4][3] -- you decide if you want to favor rows over columns. Your method should place the elements of the one-dimensional array into the two-dimensional array in row-major order, and fill the remaining elements with 0 (for integer arrays) or null (for String arrays). The process of filling unused elements with 0 or null is called padding. If the input array's length is a perfect square, e.g., [16], then your output should a square array, i.e., [4][4]. For any other size, your objective is to minimize the number of padded elements. For example, if your input is [10] you should opt for a [3][4] array instead of a [4][4]. The former will have only 2 padded elements; the latter 6.
=======================================================
//Class header definition
public class DisArray {
//First method with int array as parameter
public static void convert2D(int[] oneD) {
//1. First calculate the number of columns
//a. get the length of the one dimensional array
int arraylength = oneD.length;
//b. find the square root of the length and typecast it into a float
float squareroot = (float) Math.sqrt(arraylength);
//c. round off the result and save in a variable called row
int row = Math.round(squareroot);
//2. Secondly, calculate the number of columns
//a. if the square of the number of rows is greater than or equal to the
//length of the one dimensional array,
//then to minimize padding, the number of
//columns is the same as the number of rows.
//b. otherwise, the number of columns in one more than the
// number of rows
int col = ((row * row) >= arraylength) ? row : row + 1;
//3. Create a 2D int array with the number of rows and cols
int [ ][ ] twoD = new int [row][col];
//4. Place the elements in the one dimensional array into
//the two dimensional array.
//a. First create a variable counter to control the cycle through the one
// dimensional array.
int counter = 0;
//b. Create two for loops to loop through the rows and columns of the
// two dimensional array.
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
//if counter is less then the length of the one dimensional array,
//then copy the element at that position into the two dimensional
//array. And also increment counter by one.
if (counter < oneD.length) {
twoD[i][j] = oneD[counter];
counter++;
}
//Otherwise, just pad the array with zeros
else {
twoD[i][j] = 0;
}
}
}
//You might want to create another pair of loop to print the elements
//in the populated two dimensional array as follows
for (int i = 0; i < twoD.length; i++) {
for (int j = 0; j < twoD[i].length; j++) {
System.out.print(twoD[i][j] + " ");
}
System.out.println("");
}
} //End of first method
//Second method with String array as parameter
public static void convert2D(String[] oneD) {
//1. First calculate the number of columns
//a. get the length of the one dimensional array
int arraylength = oneD.length;
//b. find the square root of the length and typecast it into a float
float squareroot = (float) Math.sqrt(arraylength);
//c. round off the result and save in a variable called row
int row = Math.round(squareroot);
//2. Secondly, calculate the number of columns
//a. if the square of the number of rows is greater than or equal to the length of
//the one dimensional array, then to minimize padding, the number of
//columns is the same as the number of rows.
//b. otherwise, the number of columns in one more than the
//number of rows.
int col = (row * row >= arraylength) ? row : row + 1;
//3. Create a 2D String array with the number of rows and cols
String[][] twoD = new String[row][col];
//4. Place the elements in the one dimensional array into the two
// dimensional array.
//a. First create a variable counter to control the cycle through the one
// dimensional array.
int counter = 0;
//b. Create two for loops to loop through the rows and columns of the
//two dimensional array.
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
//if counter is less then the length of the one dimensional array,
//then copy the element at that position into the two dimensional
//array. And also increment counter by one.
if (counter < oneD.length) {
twoD[i][j] = oneD[counter];
counter++;
}
//Otherwise, just pad the array with null values
else {
twoD[i][j] = null;
}
}
}
//You might want to create another pair of loop to print the elements
//in the populated two dimensional array as follows:
for (int i = 0; i < twoD.length; i++) {
for (int j = 0; j < twoD[i].length; j++) {
System.out.print(twoD[i][j] + " ");
}
System.out.println("");
}
} // End of the second method
//Create the main method
public static void main(String[] args) {
//1. Create an arbitrary one dimensional int array
int[] x = {23, 3, 4, 3, 2, 4, 3, 3, 5, 6, 5, 3, 5, 5, 6, 3};
//2. Create an arbitrary two dimensional String array
String[] names = {"abc", "john", "dow", "doe", "xyz"};
//Call the respective methods
convert2D(x);
System.out.println("");
convert2D(names);
} // End of the main method
} // End of class definition
=========================================================
==========================================================
Sample Output23 3 4 3
2 4 3 3
5 6 5 3
5 5 6 3
abc john dow
doe xyz null
==========================================================
Explanation:The above code has been written in Java and it contains comments explaining each line of the code. Please go through the comments. The actual executable lines of code are written in bold-face to distinguish them from the comments.
Part 1: For this assignment, call it assign0 Implement the following library and driver program under assign0: Your library will be consisting of myio.h and myio.c. The function prototypes as well as more explanations are listed in myio.h. Please download it and accordingly implement the exported functions in myio.c. Basically, you are asked to develop a simple I/O library which exports a few functions to simplify the reading of an integer, a double, and more importantly a string (whole line). In contrast to standard I/O functions that can read strings (e.g., scanf with "%s", fgets) into a given static size buffer, your function should read the given input line of characters terminated by a newline character into a dynamically allocated and resized buffer based on the length of the given input line. Also your functions should check for possible errors (e.g., not an integer, not a double, illigal input, no memory etc.) and appropriately handle them. Then write a driver program driver.c that can simply use the functions from myio library. Specifically, your driver program should get four command-line arguments: x y z output_filename. It then prompts/reads x many integers, y many doubles, and z many lines, and prints them into a file called output_filename.txt. Possible errors should be printed on stderr.
myio.h file
/*
* File: myio.h
* Version: 1.0
* -----------------------------------------------------
* This interface provides access to a basic library of
* functions that simplify the reading of input data.
*/
#ifndef _myio_h
#define _myio_h
/*
* Function: ReadInteger
* Usage: i = ReadInteger();
* ------------------------
* ReadInteger reads a line of text from standard input and scans
* it as an integer. The integer value is returned. If an
* integer cannot be scanned or if more characters follow the
* number, the user is given a chance to retry.
*/
int ReadInteger(void);
/*
* Function: ReadDouble
* Usage: x = ReadDouble();
* ---------------------
* ReadDouble reads a line of text from standard input and scans
* it as a double. If the number cannot be scanned or if extra
* characters follow after the number ends, the user is given
* a chance to reenter the value.
*/
double ReadDouble(void);
/*
* Function: ReadLine
* Usage: s = ReadLine();
* ---------------------
* ReadLine reads a line of text from standard input and returns
* the line as a string. The newline character that terminates
* the input is not stored as part of the string.
*/
char *ReadLine(void);
/*
* Function: ReadLine
* Usage: s = ReadLine(infile);
* ----------------------------
* ReadLineFile reads a line of text from the input file and
* returns the line as a string. The newline character
* that terminates the input is not stored as part of the
* string. The ReadLine function returns NULL if infile
* is at the end-of-file position. Actually, above ReadLine();
* can simply be implemented as return(ReadLineFile(stdin)); */
char *ReadLineFile(FILE *infile);
#endif
Answer:
Explanation:
PROGRAM
main.c
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "myio.h"
int checkInt(char *arg);
int main(int argc, char *argv[]) {
int doubles, i, ints, lines;
char newline;
FILE *out;
int x, y, z;
newline = '\n';
if (argc != 5) {
printf("Usage is x y z output_filename\n");
return 0;
}
if (checkInt(argv[1]) != 0)
return 0;
ints = atoi(argv[1]);
if (checkInt(argv[2]) != 0)
return 0;
doubles = atoi(argv[2]);
if (checkInt(argv[3]) != 0)
return 0;
lines = atoi(argv[3]);
out = fopen(argv[4], "a");
if (out == NULL) {
perror("File could not be opened");
return 0;
}
for (x = 0; x < ints; x++) {
int n = ReadInteger();
printf("%d\n", n);
fprintf(out, "%d\n", n);
}
for (y = 0; y < doubles; y++) {
double d = ReadDouble();
printf("%lf\n", d);
fprintf(out, "%lf\n", d);
}
for (z = 0; z < lines; z++) {
char *l = ReadLine();
printf("%s\n", l);
fprintf(out, "%s\n", l);
free(l);
}
fclose(out);
return 0;
}
int checkInt(char *arg) {
int x;
x = 0;
while (arg[x] != '\0') {
if (arg[x] > '9' || arg[x] < '0') {
printf("Improper input. x, y, and z must be ints.\n");
return -1;
}
x++;
}
return 0;
}
myio.c
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
char *ReadInput(int fd) {
char buf[BUFSIZ];
int i;
char *input;
int r, ret, x;
i = 1;
r = 0;
ret = 1;
input = calloc(BUFSIZ, sizeof(char));
while (ret > 0) {
ret = read(fd, &buf, BUFSIZ);
for (x = 0; x < BUFSIZ; x++) {
if (buf[x] == '\n' || buf[x] == EOF) {
ret = -1;
break;
}
input[x*i] = buf[x];
r++;
}
i++;
if (ret != -1)
input = realloc(input, BUFSIZ*i);
}
if (r == 0)
return NULL;
input[r] = '\0';
input = realloc(input, r+1);
return(input);
}
int ReadInteger() {
char *input;
int go, num, x;
go = 0;
do {
go = 0;
printf("Input an integer\n");
input = ReadInput(STDIN_FILENO);
for (x = 0; x < INT_MAX; x++) {
if (x == 0&& input[x] == '-')
continue;
if (input[x] == 0)
break;
else if (input[x]> '9' || input[x] < '0') {
go = 1;
printf("Improper input\n");
break;
}
}
} while (go == 1);
num = atoi(input);
free(input);
return num;
}
double ReadDouble(void) {
int dec, exp;
char *input;
int go;
double num;
int x;
do {
go = 0;
dec = 0;
exp = 0;
printf("Input a double\n");
input = ReadInput(STDIN_FILENO);
for (x = 0; x < INT_MAX; x++) {
if (x == 0&& input[x] == '-')
continue;
if (input[x] == 0)
break;
else if (input[x] == '.' && dec == 0)
dec = 1;
else if (x != 0&& (input[x] == 'e' || input[x] == 'E') && exp == 0) {
dec = 1;
exp = 1;
}
else if (input[x]> '9' || input[x] < '0') {
go = 1;
printf("Improper input\n");
break;
}
}
} while (go == 1);
num = strtod(input, NULL);
free(input);
return num;
}
char *ReadLine(void) {
printf("Input a line\n");
return(ReadInput(STDIN_FILENO));
}
char *ReadLineFile(FILE *infile) {
int fd;
fd = fileno(infile);
return(ReadInput(fd));
}
myio.h
#ifndef _myio_h
#define _myio_h
/*
* Function: ReadInteger
* Usage: i = ReadInteger();
* ------------------------
* ReadInteger reads a line of text from standard input and scans
* it as an integer. The integer value is returned. If an
* integer cannot be scanned or if more characters follow the
* number, the user is given a chance to retry.
*/
int ReadInteger(void);
/*
* Function: ReadDouble
* Usage: x = ReadDouble();
* ---------------------
* ReadDouble reads a line of text from standard input and scans
* it as a double. If the number cannot be scanned or if extra
* characters follow after the number ends, the user is given
* a chance to reenter the value.
*/
double ReadDouble(void);
/*
* Function: ReadLine
* Usage: s = ReadLine();
* ---------------------
* ReadLine reads a line of text from standard input and returns
* the line as a string. The newline character that terminates
* the input is not stored as part of the string.
*/
char *ReadLine(void);
/*
* Function: ReadLine
* Usage: s = ReadLine(infile);
* ----------------------------
* ReadLineFile reads a line of text from the input file and
* returns the line as a string. The newline character
* that terminates the input is not stored as part of the
* string. The ReadLine function returns NULL if infile
* is at the end-of-file position. Actually, above ReadLine();
* can simply be implemented as return(ReadLineFile(stdin)); */
char *ReadLineFile(FILE *infile);
Integers numChildrenA, numChildrenB, numChildrenC, and numFamilies are read from input. Compute the average children per family using floating-point division, and assign the result to avgFamilies.
Ex: If the input is 13 11 3 3, then the output is:
9.0
The code is given below
scss
numChildrenA = int(input())
numChildrenB = int(input())
numChildrenC = int(input())
numFamilies = int(input())
avgFamilies = (numChildrenA + numChildrenB + numChildrenC) / numFamilies
print(avgFamilies)
What is the Integers about?
The code reads four integers from input and stores them in variables numChildrenA, numChildrenB, numChildrenC, and numFamilies.
Then, it calculates the average number of children per family by dividing the total number of children (numChildrenA + numChildrenB + numChildrenC) by the number of families (numFamilies). The result is stored in the variable avgFamilies.
Finally, the code prints the value of avgFamilies, which represents the average number of children per family. Note that the division operator (/) performs floating-point division, so the result will be a floating-point number even if the input is all integers.
Learn more about Integers from
https://brainly.com/question/24128001
#SPJ1
Meryl works in the audio-video department
Answer:
Graphics: jpg, png
Audio: wav, mp3
Video: mpg avi
Whose guidelines should you follow for the destruction of storage media such as thumb drives, Zip drives, and computers?
Answer:
Depends how bad you want to hide something. If the drive has previously been encrypted and the password hashed (like AES-256 with SHA-512 hashing), then deleting the content is enough since it will be slightly overridden and thus unusable. If it is not encrypted already, delete it, and override all your disk space with something. If you want it to die as a secrete 100%, burn it and pulverize it. Otherwise, if you want a quick method, use some real delete software.
this sql query can be used to identify the percentage of contributions from prospects compared to total donors:
SELECTevent_contributions,Total_donors, Total_prospects (Total_prospects/ Total_donors*100) AS Prospects_Precents FROM contributions_data
True
False
It is a true statement that section of a SQL query that will calculate the percentage of contributions from prospects is (Total prospects / Total donors * 100) AS Prospects Percent.
What is brief account on SQL?For handling data stored in a relational database management system, the computer language known as Structured Query Language was developed. When dealing with structured data, which includes relationships between entities and variables, it is especially helpful.
Over read-write APIs like ISAM or VSAM, the SQL has two key advantages, which are proposed the concept of performing multiple records' access with a single command and it does away with the necessity to indicate whether or not an index is
To learn more about SQL refers to;
brainly.com/question/30037267
#SPJ4
Which of the following had already existed in Africa before the Portuguese arrived?
A. Widespread practice of Christianity
B. The Triangle trade
C. European colonialism
D. Extensive trade networks
Answer:
D. Extensive trade networks
Explanation:
Trade in in raw materials as well as manufactured goods and other items was already established in Africa before the coming of the Europeans. There were already many trade routes by which African Kingdoms traded in diverse commodities in many renowned kingdoms of Africa before the Trans-Atlantic slave trade.
Trading was carried out on land and by waterways, these existing trade network enabled the Europeans to have access to Africa . Without these existing trade routes, the penetration of the Europeans would have been more challenging.
Answer:
The answer is D. Exstensive trade networks
Explanation:
I just took the test it is correct :)
what is computer hardware
Computer hardware refers to the physical components of a computer system that can be seen and touched. It encompasses all the tangible parts that make up a computer, enabling it to function and perform various tasks. Hardware includes devices such as the central processing unit (CPU), memory (RAM), storage devices (hard drives, solid-state drives), input devices (keyboard, mouse), output devices (monitor, printer), and other peripheral devices (speakers, scanners, etc.).
These hardware components work together to execute and manage data and instructions within a computer system. The CPU acts as the brain of the computer, performing calculations and executing instructions. Memory provides temporary storage for data and instructions that the CPU can quickly access. Storage devices store data in a more permanent manner, allowing it to be retained even when the computer is turned off.
Input devices enable users to input data and commands into the computer, while output devices display or present processed information to the user. Peripheral devices expand the capabilities of the computer system, providing additional functionalities and connectivity options.
Computer hardware is essential for the functioning of a computer and determines its processing power, storage capacity, and overall performance. It is complemented by software, which provides the instructions and programs necessary to utilize the hardware effectively. Together, hardware and software form the foundation of modern computer systems.
For more such questions on components, click on:
https://brainly.com/question/28351472
#SPJ11
Sense HAT Emulator Loop Python Assignment
1. Create an instance of the SenseHat class.
2. Write a while loop that iterates count from 1 to 10 and scrolls the value of count in red text with a scroll speed of 0.1.
3. Write a while loop that iterates count from 0 to 30 but the iteration number is advanced by 5 rather than by 1 and scrolls
the value of count in green text with a scroll speed of 0.1.
4. Write a for loop that iterates count from 3 to 98 in steps of 5 and scrolls the value of count in blue text with a scroll speed
of 0.1.
SENSE HAT EMULATOR
Answer:
Here's the Python code for the Sense HAT emulator loop assignment:
from sense_emu import SenseHat
import time
sense = SenseHat()
# Loop 1 - red text, count from 1 to 10
for count in range(1, 11):
sense.show_message(str(count), text_colour=[255, 0, 0], scroll_speed=0.1)
time.sleep(1)
# Loop 2 - green text, count from 0 to 30 (by 5s)
for count in range(0, 31, 5):
sense.show_message(str(count), text_colour=[0, 255, 0], scroll_speed=0.1)
time.sleep(1)
# Loop 3 - blue text, count from 3 to 98 (by 5s)
for count in range(3, 99, 5):
sense.show_message(str(count), text_colour=[0, 0, 255], scroll_speed=0.1)
time.sleep(1)
Explanation:
This code uses the SenseHat class to create an instance of the Sense HAT emulator. It then includes three different loops, each with a different color and range of numbers to iterate through. The show_message() method is used to display the current count value in a scrolling text format, with the specified text color and scroll speed. The sleep() method is used to pause the loop for 1 second between each iteration, so that the text has time to scroll completely before the next iteration begins.
Which of the following roles is responsible for
overseeing the data and operation of databases?
computer support specialist
data miner
database programmer
database administrator
Create and maintain databases that are appropriate for the needs of their organizations, as database managers or administrators. These IT specialists are in charge of maintaining, storing, protecting, and troubleshooting databases.
What is database management?
Data is stored, retrieved, and analyzed using software called database management systems (DBMS). Users can create, read, update, and delete data in databases using a DBMS, which acts as an interface between them and the databases.
A software program is used to administer databases, or database management systems. As an illustration, popular commercial databases like MySQL, Oracle, etc. are utilised in a variety of applications.
A DBMS provides an interface for carrying out a variety of tasks, including building databases, putting data in them, updating data, creating tables in the databases, and many other things.
It offers database security and safety. Additionally, it preserves data consistency when there are many users.
Hence to conclude dbms has the responsibilty of overseeing the data and operation of databases
To know more on dbms follow this link
https://brainly.com/question/24027204
#SPJ1
Answer:
D!
Explanation:
Write a Python program that makes a database of students. A student's record Have the following fields: • first_name • last_name • studentld grade_in_school (i.e. 7th or 8th grade) • grade_in_class (i.e. A or B) The program will ask the user to insert a number of student's records from the keyboard, collect their information. Based on the following menu selections implement the following functionality: a) Print the student's records on the screen. Use a self-defined clean tabular Format b) Display the records of all 8th graders c) Display the records of all students with an A in the class who are seven graders d) Display the records of the students whose last name starts with the letter "M"
Using the knowledge in computational language in python it is possible to write a code that will ask the user to insert a number of student's records from the keyboard
Writting the code:D = dict()
n = int(input('How many student record you want to store?? '))
# Add student information
# to the dictionary
for i in range(0,n):
x, y = input("Enter the complete name (First and last name) of student: ").split()
z = input("Enter contact number: ")
m = input('Enter Marks: ')
D[x, y] = (z, m)
# define a function for shorting
# names based on first name
def sort():
ls = list()
# fetch key and value using
# items() method
for sname,details in D.items():
# store key parts as an tuple
tup = (sname[0],sname[1])
# add tuple to the list
ls.append(tup)
# sort the final list of tuples
ls = sorted(ls)
for i in ls:
# print first name and second name
print(i[0],i[1])
return
# define a function for
# finding the minimum marks
# in stored data
def minmarks():
ls = list()
# fetch key and value using
# items() methods
for sname,details in D.items():
# add details second element
# (marks) to the list
ls.append(details[1])
# sort the list elements
ls = sorted(ls)
print("Minimum marks: ", min(ls))
return
# define a function for searching
# student contact number
def searchdetail(fname):
ls = list()
for sname,details in D.items():
tup=(sname,details)
ls.append(tup)
for i in ls:
if i[0][0] == fname:
print(i[1][0])
return
# define a function for
# asking the options
def option():
choice = int(input('Enter the operation detail: \n \
1: Sorting using first name \n \
2: Finding Minimum marks \n \
3: Search contact number using first name: \n \
4: Exit\n \
Option: '))
if choice == 1:
# function call
sort()
print('Want to perform some other operation??? Y or N: ')
inp = input()
if inp == 'Y':
option()
# exit function call
exit()
elif choice == 2:
minmarks()
print('Want to perform some other operation??? Y or N: ')
inp = input()
if inp == 'Y':
option()
exit()
elif choice == 3:
first = input('Enter first name of student: ')
searchdetail(first)
print('Want to perform some other operation??? Y or N: ')
inp = input()
if inp == 'Y':
option()
exit()
else:
print('Thanks for executing me!!!!')
exit()
option()
See more about python at brainly.com/question/18502436
#SPJ1