Answer:
Given
The above lines of code
Required
Rearrange.
The code is re-arrange d as follows;.
#include<iostream>
int main()
{
int userNum;
scanf("%d", &userNum);
if (userNum > 0)
{
printf("Positive.\n");
}
else
{
printf("Non-positive, converting to 1.\n");
userNum = 1;
printf("Final: %d\n", userNum);
}
return 0;
}
When rearranging lines of codes. one has to be mindful of the programming language, the syntax of the language and control structures in the code;
One should take note of the variable declarations and usage
See attachment for .cpp file
Assume that you have a list of n home maintenance/repair tasks (numbered from 1 to n ) that must be done in numeric order on your house. You can either do each task i yourself at a positive cost (that includes your time and effort) of c[i] . Alternatively, you could hire a handyman who will do the next 4 tasks for the fixed cost h (regardless of how much time and effort those 4 tasks would cost you). The handyman always does 4 tasks and cannot be used if fewer than four tasks remain. Create a dynamic programming algorithm that finds a minimum cost way of completing the tasks. The inputs to the problem are h and the array of costs c[1],...,c[n] .
a) Find and justify a recurrence (without boundary conditions) giving the optimal cost for completing the tasks. Use M(j) for the minimum cost required to do the first j tasks.
b) Give an O(n) -time recursive algorithm with memoization for calculating the M(j) values.
c) Give an O(n) -time bottom-up algorithm for filling in the array.
d) Describe how to determine which tasks to do yourself, and which tasks to hire the handyman for in an optimal solution.
Answer:
Explanation:
(a) The recurrence relation for the given problem is :
T(n) = T(n-1) + T(n-4) + 1
(b) The O(n) time recursive algorithm with memoization for the above recurrence is given below :
Create a 1-d array 'memo' of size, n (1-based indexing) and initialize its elements with -1.
func : a recursive function that accepts the cost array and startingJobNo and returns the minimum cost for doing the jobs from startingJobNo to n.
Algorithm :
func(costArr[], startingJobNo){
if(startingJobNo>n)
then return 0
END if
if(memo[startingJobNo] != -1)
then return memo[startingJobNo];
END if
int ans1 = func(costArr, startingJobNo+1) + costArr[startingJobNo]
int ans2 = func(costArr, startingJobNo+4) + h
memo[startingJobNo] = min(ans1,ans2);
return memo[startingJobNo];
}
(c)
First, Create a 1-d array 'dp' of size, N+1.
dp[0] = 0
bottomUp(int c[]){
for i=1 till i = n
DO
dp[i] = min(dp[i-1] + c[i], dp[max(0,i-4)] + h);
END FOR
return dp[n];
}
(d)
Modifying the algorithm given in part (b) as follows to know which job to do yourself and in which jobs we need to hire a handyman.
First, Create a 1-d array 'memo' of size, n (1-based indexing) and initialize its elements with -1.
Next, Create another 1-d array 'worker' of size,n (1-based indexing) and initialize its elements with character 'y' representing yourself.
Algorithm :
func(costArr[], startingJobNo){
if(startingJobNo>n)
then return 0
END if
if(memo[startingJobNo] != -1)
then return memo[startingJobNo];
END if
int ans1 = func(costArr, startingJobNo+1) + costArr[startingJobNo]
int ans2 = func(costArr, startingJobNo+4) + h
if(ans2 < ans1)
THEN
for (i = startingJobNo; i<startingJobNo+4 and i<=n; i++)
DO
// mark worker[i] with 'h' representing that we need to hire a mechanic for that job
worker[i] = 'h';
END for
END if
memo[startingJobNo] = min(ans1,ans2);
return memo[startingJobNo];
}
//the worker array will contain 'y' or 'h' representing whether the ith job is to be done 'yourself' or by 'hired man' respectively.
What is an accessory?
A.a security setting that controls the programs children can use
B.a tool that provides proof of identity in a computing environment
C.a set of programs and applications that help users with basic tasks
D.a set of gadgets and widgets that makes it easier to create shortcuts
Answer:
C
Explanation:
Accessories are in Microsoft windows, a set of programs and applications that help users with some basic tasks
You have observed that Alexander Rocco Corporation uses Alika’s Cleaning Company for its janitorial services. The company’s floors are vacuumed and mopped each night, and the trash is collected in large bins placed outside for pickup on Tuesdays and Fridays. You decide to visit the dumpster Thursday evening after the cleaning crew leaves. Wearing surgical gloves and carrying a large plastic sheet, you place as much of the trash on the sheet as possible. Sorting through the material, you find the following items: a company phone directory; a Windows NT training kit; 23 outdated Oracle magazines; notes that appear to be programs written in HTML, containing links to a SQL Server database; 15 company memos from key employees; food wrappers; an empty bottle of expensive vodka; torn copies of several resumes; an unopened box of new business cards; and an old pair of women’s running shoes. Based on this information, write a two-page report explaining the relevance these items have. What recommendations, if any, might you give to Alexander Rocco management?
Answer:
Explanation:
Relevance of Thrown Items:
The thrown items mainly consist of the Windows NT training kit, outdated magazines and some written notes, etc. All these things can be used in the company for training the fresh talent. These things must be used for the purpose of training fresh people and the things like programs written in HTML must not be dumped like this because they consists of the raw code which can be harmful if gotten into wrong hands. Hence, the information like this must be taken care of seriously as these can be loopholes into companies down. Rest of the things like food wrappers, empty bottles, resume copies are all worthless to the company and can be thrown into the dump as soon as possible.The business cards must also be thrown if not important.Recommendation To Management:
The management must take these things seriously and must double check the company properties before throwing them into dump. There must be a committe build to check the things that are been going directly to the dump. They must have the responsibility for checking the things before going to the dump and must filter all the important things from the garbage back to the shelves of the office.Hence, these things must be taken care of so that no harm is to be done to the company.cheers i hope this helped !!
Write a program in C# : Pig Latin is a nonsense language. To create a word in pig Latin, you remove the first letter and then add the first letter and "ay" at the end of the word. For example, "dog" becomes "ogday" and "cat" becomes "atcay". Write a GUI program named PigLatinGUI that allows the user to enter a word and displays the pig Latin version.
Answer:
The csharp program is as follows.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string word = textBox1.Text;
string ch = word.Substring(0, 1);
string str = word.Substring(1, word.Length-1);
string s = str.Insert(str.Length, ch);
textBox2.Text = s.Insert(s.Length, "ay");
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
}
}
}
Explanation:
1. A string variable to hold the user input is declared and initialized accordingly. The user inputted string is taken from textbox1.
string word = textBox1.Text;
2. A string variable to hold the first character of the user inputted string is declared and initialized.
string ch = word.Substring(0, 1);
3. A string variable to hold the user inputted string without the first character is declared and initialized accordingly.
string str = word.Substring(1, word.Length-1);
4. A string variable to hold the substring from step 3 along with the inserted characters at the end, is declared and initialized accordingly.
string s = str.Insert(str.Length, ch);
5. The final string is assigned to the textbox 2, which is the PigLatin conversion of the user inputted string.
textBox2.Text = s.Insert(s.Length, "ay");
6. All the above take place when the user clicks Convert to PigLatin button.
7. Two additional buttons, clear and exit are also included in the form.
8. When the user clicks clear button, both the textboxes are initialized to empty string thus clearing both the textboxes.
textBox1.Text = "";
textBox2.Text = "";
9. When the user clicks the exit button, the application closes using the Close() method.
10. The program is done in Visual Studio.
11. The output of the program is attached.
12. The program can be tested for any type of string and any length of the string.
Numbering exception conditions, which often uses hierarchical numbering, in a fully developed use case description is helpful to _______. a. tie the exception condition to a processing step b. show which exception conditions are subordinate to other exceptions c. provide an identifier for each exception condition d. tie exception conditions to other diagrams or descriptions
Answer:
a) tie the exception condition to a processing step
Explanation:
Numbering exception conditions, in a fully developed use case description is helpful to tie the exception condition to a processing step
The fully developed use case description is useful for the documentation of the context, purpose, description, conditions, and workflow of each use case. Activity diagrams give a graphical image of the use case workflow and serve the purpose of illustrating the alternative paths through a business process.
Write a function to_pig_latin that converts a word into pig latin, by: Removing the first character from the start of the string, Adding the first character to the end of the string, Adding "ay" to the end of the string. So, for example, this function converts "hello"to "ellohay". Call the function twice to demonstrate the behavior. There is a worked example for this kind of problem.
Answer:
def to_pig_latin(word):
new_word = word[1:] + word[0] + "ay"
return new_word
print(to_pig_latin("hello"))
print(to_pig_latin("latin"))
Explanation:
Create a function called to_pig_latin that takes one parameter, word
Inside the function, create a new_word variable and set it to the characters that are between the second character and the last character (both included) of the word (use slicing) + first character of the word + "ay". Then, return the new_word.
Call the to_pig_latin function twice, first pass the "hello" as parameter, and then pass the "latin" as parameter
Answer:
...huh?
Explanation:
In this assignment, you will develop a C++ program and a flowchart that calculates a cost to replace all tablets and desktop computers in a business. Customers paying cash get a ten percent discount applied to the total cost of the computers (desktop and tablets). Customers financing the purchase incur a fifteen percent finance charge based on the total cost of the computers (desktop and tablets). Tablets costs $320.00 each and desktops costs $800.00 each. The tax is 75% (.075).
Requirements:
⦁ Use the following variables of the appropriate type: name of company selling the computers, the cost per each type of computer, number of computers to be purchased, discount if paying cash, sales tax rate. Tablets =$320 each and desktop computers = $800.00 each. Sales Tax Rate = .075, Discount Percent = .10, and Finance Charge = .15.
⦁ Variable names must be descriptive.
⦁ Use additional variables to hold subtotals and totals.
⦁ For customers paying cash, the discount should be subtracted from the total computer cost.
⦁ For customers financing the purchase, the finance charge should be added to the total computer cost.
⦁ The body of your program must use variables only; there should not be any "hard coded" values in the output statements. An example of hardcoding is
***Cost of tablets = 4 * 320****.
⦁ Use cout to output the values of the variables to the console. Your cout statement MUST use the variables to display the values
⦁ Display the cost of the computers, tax and average cost per computer. The average cost will be the total cost divided by the number of computers purchased. Display the discount if the customer decides to pay cash or the finance charge if the customer finances the purchase.
⦁ Output must be labelled and easy to read as shown in the sample output below.
⦁ Program must be documented with the following:
⦁ // Name
⦁ // Date
⦁ // Program Name
⦁ // Description
⦁ Develop a flowchart
Hints:
Total cost of computers = cost per tablet * number of tablets purchased + cost per desktop * number of desktops purchased
Calculate the cost if paying cash or financing
Calculate the tax
Average cost per computer = Total computer cost divided by the number of computers purchased
Answer:
Explanation:
The objective of this program we are to develop is to compute a C++ program and a flowchart that calculates a cost to replace all tablets and desktop computers in a business.
C++ Program
#include<iostream>
#include<iomanip>
using namespace std;
/*
⦁ // Name:
⦁ // Date:
⦁ // Program Name:
⦁ // Description:
*/
int main()
{
const double SalesTaxRate = .075, DiscountPercent = .10, FinanceCharge = .15;
const double TABLET = 320.00, DESKTOP = 800.00;
double total = 0.0, subTotal = 0.0,avg=0.0;
int numberOfTablets, numberOfDesktop;
cout << "-------------- Welcome to Computer Selling Company ------------------ ";
cout << "Enter number of tablets: ";
cin >> numberOfTablets;
cout << "Enter number of desktops: ";
cin >> numberOfDesktop;
subTotal = TABLET * numberOfTablets + numberOfDesktop * DESKTOP;
char choice;
cout << "Paying cash or financing: (c/f): ";
cin >> choice;
cout << fixed << setprecision(2);
if (choice == 'c' || choice == 'C')
{
cout << "You have choosen paying cash." << endl;
total = subTotal - subTotal * DiscountPercent;
cout << "Discount you get $" << subTotal * DiscountPercent<<endl;
cout << "Sales Tax: $" << SalesTaxRate * total << endl;
total = total + total * SalesTaxRate;
cout << "Total computers' Cost: $" << total << endl;
avg = total / (numberOfDesktop + numberOfTablets);
cout << "Average computer cost: $ " << avg << endl;
}
else if (choice == 'f' || choice == 'F')
{
cout << "You have choosen Finance option." << endl;
total = subTotal + subTotal * FinanceCharge;
cout << "Finance Charge $" << subTotal * FinanceCharge << endl;
cout << "Sales Tax: $" << SalesTaxRate * total << endl;
total = total + total * SalesTaxRate;
cout << "Total computers' Cost: $" << total << endl;
avg = total / (numberOfDesktop + numberOfTablets);
cout << "Average computer cost: $ " << avg << endl;
}
else
{
cout << "Wrong choice.......Existing.... ";
system("pause");
}
//to hold the output screen
system("pause");
} }
OUTPUT:
The Output of the program is shown in the first data file attached below:
FLOWCHART:
See the second diagram attached for the designed flowchart.
A(n) ________ is a server-based operating system oriented to computer networking and may include directory services, network management, network monitoring, network policies, user group management, network security, and other network-related functions.
Answer:
Network Operating System (NOS)
Explanation:
A network operating system (NOS) is an operating system that makes different computer devices connect to a common network in order to communicate and share resources with each other using a server. A network operating system can be used by printers, computers, file sever among others, and they are connected together using a local area network. This local area network which they are connected to works as the server.
The NOS also acts as a network security because it could be used as an access control or even user authentication.
There are two types of NOS
1) Peer to peer network operating system.
2) Client/server network operating system
A network operating system (NOS) is a server-based operating system oriented to computer networking and may include directory services, network management, network monitoring, network policies, user group management, network security, and other network-related functions.
It's inventiveness, uncertainty futuristic ideas typically deal with science and technology.what is it?
Answer:
Engineering and Science
Explanation:
Which of the following does Google use to display the characters of the page’s meta title?
Explanation:
search engine because it helps to search find what you are expecting to search in the google.
Your computer is once again out of hard drive and you want to see which folders are consuming the most space on your drive. Which application below will do this? A. CClreaner B. Treesize C MalwareBytes D. Auslogics Disk Defrag
Answer:
I would say cclrearner
Explanation:
This is what helped me with my computer so it may help you but try which one works for you
The U.S. continues to become more dependent on the global domain within the information environment consisting of the interdependent network of information technology infrastructures, including the Internet, telecommunications networks, computer systems, and embedded processors and controllers. It is imperative that we safeguard this domain known as _____.
Answer:
cyberspace
Explanation:
It is the notional environment in which communication over computer networks occurs.
It is imperative that we safeguard this domain known as cyberspace.
What is cyberspace?The meaning of the cyberspace is the climate of the Internet.
There is large network of computers connected together in offices or organizations to explore the internet. The cyberspace has formed the first important needed thing in this century without which nothing can be done in personal space or in any companies.
The U.S. continues to become more dependent on the global domain within the information environment consisting of the interdependent network of information technology infrastructures, including the Internet, telecommunications networks, computer systems, and embedded processors and controllers.
So, we safeguard this domain known a cyberspace.
Learn more about cyberspace.
https://brainly.com/question/832052
#SPJ2
Assume passwords are selected from four character combinations of 26 lower case alphabetic characters. Assume an adversary is able to attempt passwords at a rate of 1 per second. Assuming feedback to the adversary flagging an error as each incorrect character is entered, what is the expected time to discover the correct password
Answer:
Given:
Passwords are selected from 4 characters.
Character combinations are 26 lower case alphabetic characters.
Passwords attempts by adversary is at rate of 1 second.
To find:
Expected time to discover the correct password
Explanation:
Solution:
4 character combinations of 26 alphabetic characters at the rate of one attempt at every 1 second = 26 * 4 = 104
So 104 seconds is the time to discover the correct password. However this is the worst case scenario when adversary has to go through every possible combination. An average time or expected time to discover the correct password is:
13 * 4 = 52
You can also write it as 104 / 2 = 52 to discover the correct password. This is when at least half of the password attempts seem to be correct.
For this project, you have to write 3 functions. C++
1. remove_adjacent_digits. This takes in 2 arguments, a std::vector, and a std::vector of the same size. You need to return a std::vector, where each of the strings no longer has any digits that are equal to, one more, or one less, than the corresponding integer in the 2nd vector.
2. sort_by_internal_numbers. This takes in a single argument, a std::vector, and you need to return a std::vector, which is sorted as if only the digits of each string is used to make a number.
3. sort_by_length_2nd_last_digit. This takes in a std::vector>. It returns a vector of the same type as the input, which is sorted, first by the length of the string in the pair, and if they are the same length, then the second last digit of the int.
See the test cases for examples of each of the above functions.
You need to submit a single file called main.cpp that contains all these functions. You can (and should) write additional functions as well. There is no need for a main function.
No loops (for, while, etc) are allowed. You must use only STL algorithms for this project.
Find the given attachments
The following are reasons why many organizations are trying to reduce and right-size their information foot-print by using data governance techniques like data cleansing and de-duplication:
A. None of the above
B. reduce risk of systems failures due to overloading
C. improve data quality and reduce redundancies, reduce increased and staggering storage management costs,
D. Both A and B
Answer:
C. improve data quality and reduce redundancies, reduce increased and staggering storage management costs
Explanation:
Excess data retention can lead to retention of redundant and irrelevant data, which can reduce data handling and processing efficiency, while at the same time increasing the cost of data storage and management. This can be curbed be reducing data to the right size by using data governance techniques like data cleansing and de-duplication
How are a members details be checked and verified when they return to log back in to the website ?
Answer:
When you sign into a website, you have to enter a password and username most of the time, which will allow the website to know that you have checked in and it is you, who is using your account.
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);
A number of LC-3 instructions have an "evaluate address" step in the instruction cycle, in which a 16-bit address is constructed and written to the Memory Address Register via the MARMUX. List all LC-3 instructions that write to the MAR during the evaluate address phase of the instruction cycle, with the Register Transfer description of each.
Answer: you want to list all LC structers
Explanation:
Devon keeps his commitments, submits work when it's due, and shows up when scheduled. What personal skill does Devon
demonstrate?
Attire
Collaboration
Dependability
Verbal
It’s D
Answer:
dependability
Explanation:
devon keeps his commitment
The personal skill that's demonstrated by Devin is dependability.
Dependability simply means when an individual is trustworthy and reliable. Dependability simply means when a person can be counted on and relied upon.
In this case, since Devon keeps his commitments, submits work when it's due, and shows up when scheduled, it shows that he's dependable.
It should be noted that employers love the people that are dependable as they can be trusted to have a positive impact on an organization.
Read related link on:
https://brainly.com/question/14064977
The degree of a point in a triangulation is the number of edges incident to it. Give an example of a set of n points in the plane such that, no matter how the set is triangulated, there is always a point whose degree is n−1.
Answer:
squarepentagonExplanation:
The vertices of a square is one such set of points. Either diagonal will bring the degree of the points involved to 3 = 4-1.
The vertices of a regular pentagon is another such set of points. After joining the points in a convex hull, any interior connection will create a triangle and a quadrilateral. The diagonal of the quadrilateral will bring the degree of at least one of the points to 4 = 5-1.
Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula: futureInvestmentValue = investmentAmount * (1 + monthyInterestRate)numberOfYears*12. For example if you enter amount 1000, annual interest rate 3.25%, and number of years 1, the future investment value is 1032.98.NB: Please make sure to use the NumberFormat coding for currency to display your results. (Java Programming)
Answer:
Following are the code to this question:
import java.util.*; //importing package for user input
public class Main //defining class
{
public static void main(String []ar) //defining main method
{
double investment_amount,interest_rate,future_investment_value; //defining double variables
int years; //defining integer variable
Scanner obx=new Scanner(System.in); //creating Scanner class Object
System.out.print("Enter invest value: "); //print message
investment_amount=obx.nextDouble(); //input value
System.out.print("Enter interest rate: ");//print message
interest_rate=obx.nextDouble();//input value
System.out.print("Enter number of years: ");//print message
years=obx.nextInt();//input value
future_investment_value=investment_amount*Math.pow((1+interest_rate/1200.),years*12); //calculating value by apply formula
System.out.println("you enter amount: $"+investment_amount); //print calculated value
System.out.println("annual interest rate:"+interest_rate+"%");//print calculated value
System.out.printf("Number of years: "+years+" the future investment value is :$%.2f\n",future_investment_value);//print calculated value
}
}
output:
please find the attachment.
Explanation:
Program Description:
In the above-given program, inside the main method, a variable is declared that are investment_amount, interest_rate, future_investment_value, and years, in which only year variable is an integer type and other variables are double types.In the next step, a scanner class object that is "obx" is created, which is used to input value from the user end, in the next line we apply the formula to calculate the future_investment_value.At the last step, we all the input and a calculated valueComputers in a LAN are configured to use a symmetric key cipher within the LAN to avoid hardware address spoofing. This means that each computer share a different key with every other computer in the LAN. If there are 100 computers in this LAN, each computer must have at least:
a. 100 cipher keys
b. 99 cipher keys
c. 4950 cipher keys
d. 100000 cipher keys
Answer:
The correct answer is option (c) 4950 cipher keys
Explanation:
Solution
Given that:
From the given question we have that if there are 100 computers in a LAN, then each computer should have how many keys.
Now,
The number of computers available = 100
The number of keys used in symmetric key cipher for N parties is given as follows:
= N(N-1)/2
= 100 * (100 -1)/2
= 50 * 99
= 4950 cipher keys
Chris wants to view a travel blog her friend just created. Which tool will she use?
HTML
Web browser
Text editor
Application software
Answer:
i think html
Explanation:
Answer:
Web browser
Explanation:
Can you please at least give me some part of the code. At least how to start it in C++. Thank you!
Project 5: You will design and implement various classes and write a program to manage one of the following a bank, a hospital, a library, a business, an organization, etc.) The program must do the following:
1. Allow the initialization of the different attributes of the objects from the keyboard.
2. Allow the initialization of the different attributes from a file
3. Perform calculations on one (or more) of the attributes (e.g. calculateInterest, generateHospitalBill, calculateCheckedBooks, etc.)
4. Output a report of all objects created. The report called for by requirement 4 should output all information about each object. You will need to take advantage of the capabilities of C++ classes, inheritance and overriding.
Program Design:
1. Create at least one base class. All data members have to be private. Your main function and any function that it calls should use the member functions of this class for all transactions.
2. Create at least two derived class of the base class described in the previous point.
3. The program will maintain arrays of objects that interacts with each other to manage the designated establishment (bank, hospital, library, etc.). Please do not use anything more sophisticated than an array.
4. Keep the program simple. I am interested in whether you can demonstrate basic competence in the use of classes, inheritance, and good design.
5. All data members in the classes must be private. This is to assure that you use the C++ capabilities that this assignment is all about. Do not use any global variables.
6. When the user decides to quit the updated information is saved back to the secondary storage to give the user the option to either start fresh or continue where he/she left off at the beginning of the next execution
Answer:
Explanation:
The objective of this question is to compute a program that involve using a C++ code for designing and implementing a Bank Account Management Simulator with integrated file storage for saving details to secondary storage.
When writing this code I notice the words are more than 5000 maximum number of characters the text editor can contain, so i created a word document for it. The attached file to the word document can be found below.
Consider the following skeletal C-like program:
void fun1(void); /* prototype */
void fun2(void); /* prototype */
void fun3(void); /* prototype */
void main() {
int a, b, c;
. . .
}
void fun1(void) {
int b, c, d;
. . .
}
void fun2(void) {
int c, d, e;
. . .
}
void fun3(void) {
int d, e, f;
. . .
}
Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last function called? Include with each visible variable the name of the function in which it was defined
a. main calls funl; funl calls fun2; fun2 calls fun3
b. main calls fun1; fun1 calls fun3
c. main calls fun2; fun2 calls fun3; fun3 calls funl
d. main calls fun1; funl calls fun3; fun3 calls fun2.
Answer:
In dynamic scoping the current block is searched by the compiler and then all calling functions consecutively e.g. if a function a() calls a separately defined function b() then b() does have access to the local variables of a(). The visible variables with the name of the function in which it was defined are given below.
Explanation:
a. main calls fun1; fun1 calls fun2; fun2 calls fun3
Solution:
Visible Variable: d, e, f Defined in: fun3Visible Variable: c Defined in: fun2 ( the variables d and e of fun2 are not visible)Visible Variable: b Defined in: fun1 ( c and d of func1 are hidden)Visible Variable: a Defined in: main (b,c are hidden)b. main calls fun1; fun1 calls fun3
Solution:
Visible Variable: d, e, f Defined in: fun3 Visible Variable: b, c Defined in: fun1 (d not visible)Visible Variable: a Defined in: main ( b and c not visible)c. main calls fun2; fun2 calls fun3; fun3 calls fun1
Solution:
Visible Variable: b, c, d Defined in: fun1 Visible Variable: e, f Defined in: fun3 ( d not visible)Visible Variable: a Defined in: main ( b and c not visible)Here variables c, d and e of fun2 are not visible .
d. main calls fun1; fun1 calls fun3; fun3 calls fun2
Solution:
Visible Variable: c, d, e Defined in: fun2Visible Variable: f Defined in: fun3 ( d and e not visible)Visible Variable: b Defined in: fun1 ( c and d not visible)Visible Variable: a Defined in: main ( b and c not visible)If you were required to give a speech identifying the risks of using computers and digital devices, which group of items would you include?
Camera and Mic
These 2 things are the most likely things to get you in trouble. Unless you have a 100% protected device, and honestly even if you do, cover up the camera and close your mic. This will definitely save you later.
windows can create a mirror set with two drives for data redundancy which is also known as
Answer:
Raid
Explanation:
The Fast Freight Shipping Company charges the following rates for different package weights:
2 pounds or less: $1.50
over 2 pounds but not more than 6 pounds: $3.00
over 6 pounds but not more than 10 pounds: $4.00
over 10 pounds: $4.75
Write a program that asks the user to enter the weight of a package and then displays the shipping charges. The program should also do "Input Validation" that only takes positive input values and show a message "invalid input value!" otherwise.
Answer:
import java.util.Scanner;
public class ShippingCharge
{
static double wt_2=1.50;
static double wt_6=3;
static double wt_10=4;
static double wt_more=4.75;
static double charge;
static double weight;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
do
{
System.out.print("Enter the weight of the package: ");
weight = sc.nextDouble();
if(weight<=0)
System.out.println("Invalid input value!");
}while(weight<=0);
if(weight<=2)
charge=wt_2;
else if(weight<=6 && weight>2)
charge=wt_6;
else if(weight<=10 && weight>6)
charge=wt_10;
else
charge=wt_more;
System.out.println("Shipping charges for the entered weight are $"+charge);
}
}
OUTPUT
Enter the weight of the package: 0
Invalid input value!
Enter the weight of the package: 4
Shipping charges for the entered weight are $3.0
Explanation:
1. The variables to hold all the shipping charges are declared as double and initialized.
static double wt_2=1.50;
static double wt_6=3;
static double wt_10=4;
static double wt_more=4.75;
2. The variable to hold the user input is declared as double.
static double charge;
static double weight;
3. The variable to hold the final shipping charge is also declared as double.
4. Inside main(), an object of Scanner class is created. This is not declared static since declared inside a static method, main().
Scanner sc = new Scanner(System.in);
5. Inside do-while loop, user input is taken until a valid value is entered.
6. Outside the loop, the final shipping charge is computed using multiple if-else statements.
7. The final shipping charge is then displayed to the user.
8. All the code is written inside class since java is a purely object-oriented language.
9. The object of the class is not created since only a single class is involved.
10. The class having the main() method is declared public.
11. The program is saved with the same name as that of the class having the main() method.
12. The program will be saved as ShippingCharge.java.
13. All the variables are declared as static since they are declared outside main(), at the class level.
Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue accepting scores until the user enters a negative value. Finally, calculate and display the average for the entered scores.
Answer:
total = 0
count = 0
while(True):
grade = float(input("Enter a grade: "))
if grade < 0:
break
else:
total += grade
count += 1
average = total/count
print("The average is: " + str(average))
Explanation:
*The code is in Python.
Initialize the total and count as 0
Create a while loop that iterates until a specific condition is met inside the loop
Inside the loop, ask the user to enter a grade. If the grade is smaller than 0, stop the loop. Otherwise, add the grade to the total and increment the count by 1.
When the loop is done, calculate the average, divide the total by count, and print it
Write a C++ program to find if a given array of integers is sorted in a descending order. The program should print "SORTED" if the array is sorted in a descending order and "UNSORTED" otherwise. Keep in mind that the program should print "SORTED" or "UNSORTED" only once.
Answer:
The cpp program for the given scenario is as follows.
#include <iostream>
#include <iterator>
using namespace std;
int main()
{
//boolean variable declared and initialized
bool sorted=true;
//integer array declared and initialized
int arr[] = {1, 2, 3, 4, 5};
//integer variables declared and initialized to length of the array, arr
int len = std::end(arr) - std::begin(arr);
//array tested for being sorted
for(int idx=0; idx<len-1; idx++)
{
if(arr[idx] < arr[idx+1])
{
sorted=false;
break;
}
}
//message displayed
if(sorted == false)
cout<< "UNSORTED" <<endl;
else
cout<< "UNSORTED" <<endl;
return 0;
}
OUTPUT
UNSORTED
Explanation:
1. An integer array, arr, is declared and initialized as shown.
int arr[] = {1, 2, 3, 4, 5};
2. An integer variable, len, is declared and initialized to the size of the array created above.
int len = std::end(arr) - std::begin(arr);
3. A Boolean variable, sorted, is declared and initialized to true.
bool sorted=true;
4. All the variables and array are declared inside main().
5. Inside for loop, the array, arr, is tested for being sorted or unsorted. The for loop executes over an integer variable, idx, which ranges from 0 till the length of the array, arr.
6. The array is assumed to be sorted if all the elements of the array are in descending order.
7. If the elements of the array are in ascending order, the Boolean variable, sorted, is assigned the value false and for loop is exited using break keyword. The testing is done using if statement.
8. Based on the value of the Boolean variable, sorted, a message is displayed to the user.
9. The program can be tested for any size of the array and for any order of the elements, ascending or descending. The program can also be tested for array of other numeric data type including float and double.
10. All the code is written inside the main().
11. The length of the array is found using begin() and end() methods as shown previously. For this, the iterator header file is included in the program.