Questions
C++ How would I sort my output to evaluate it by sorting the column by it's...

C++

How would I sort my output to evaluate it by sorting the column by it's size? I didn't include my full program but here is the main.cpp where i'm supposed to sort the output by column size.

//User Libraries
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;

//User Libraries
#include "Table.h"
#include "Triangle.h"

//Global Constants

//Function Prototype
void prntRow(RowAray *,int);
void prntTab(Table *);
void prntTri(Triangle *);


//Execution Begins Here!
int main(int argc, char** argv) {
//Initialize the random seed
srand(static_cast<unsigned int>(time(0)));

//Declare Variables
// creates a random number of rows from 1 to 10
int rows=(rand()%10)+ 1;
//creates a random number of columns from 1 to 10
int cols=(rand()%10 )+1;
int perLine=cols/2;

//Test out the RowAray
RowAray row(cols);
  
//Print the RowAray
cout<<"The Row Array size = "<<row.getSize()
<<" printed "<<perLine<<" per Line";

prntRow(&row,perLine);


//Test out the Table
Table tab(rows,cols);

//Print the Table
cout<<"The table size is [row,col] = ["<<rows<<","<<cols<<"]";
prntTab(&tab);

//Test out the Triangular Table
Triangle tri(rows);

//Print the Triangular Table
cout<<"The triangular table size is [row,row] = ["<<rows<<","<<rows<<"]";
prntTri(&tri);

//Exit Stage Right
return 0;
}

//Fill a triangular matrix
int **fillAry(int *col,int n){
int **array=new int*[n];
for(int i=0;i<n;i++){
array[i]=new int[col[i]];
}
for(int i=0;i<n;i++){
for(int j=0;j<col[i];j++){
array[i][j]=rand()%9+1;//1 Digit numbers [1-9]
}
}
return array;
}
void prntRow(RowAray *a,int perLine){
cout<<endl;
for(int i=0;i<a->getSize();i++){
cout<<a->getData(i)<<" ";
if(i%perLine==(perLine-1))cout<<endl;

}
cout<<endl;
}

void prntTab(Table *a){
cout<<endl;
for(int row=0;row<a->getSzRow();row++){
for(int col=0;col<a->getSzCol();col++){
cout<<a->getData(row,col)<<" ";
}
cout<<endl;
}
cout<<endl;
}

void prntTri(Triangle *a){
cout<<endl;
for(int row=0;row<a->getSzRow();row++){
for(int col=0;col<=row;col++){
cout<<a->getData(row,col)<<" ";
}
cout<<endl;
}
cout<<endl;
}

In: Computer Science

Explain the similarities and differences between spiders, crawlers and bots in relation to search engines. Additionally...

Explain the similarities and differences between spiders, crawlers and bots in relation to search engines. Additionally with the Search Engine Optimization elements (SEO); explaining the terms positioning and placement as they relate to SEO, with examples.

In: Computer Science

Cpp challenge Description The purpose of this challenge is to use the WHILE loop to control...

Cpp challenge

Description

The purpose of this challenge is to use the WHILE loop to control program flow. This challenge will use the WHILE loop in various ways.

Requirements

Write all your code for the following steps in one file.

  1. Ask the user to enter a single string. Ask the user to enter an integer value for a variable called repetitions. Use a while loop to display this string (of your choice) repeated repetitions times, one string per line
  2. Use a while loop to count and display all the integers from 1 to 20. Separate numbers with a space
  3. Use a while loop to display all numbers divisible by 10 starting from 100 down to 0. Only show numbers divisible by 10. Separate numbers with a tab. TAB character is displayed using the \t escape sequence. (Remember that \n is a newline; use similarly)
  4. Use a while loop to keep asking the user for an integer as long as positive numbers are being entered. For every positive number entered, show its value multiplied by 2. Once a negative number is entered stop asking and quit the loop
  5. Use a while loop to keep asking for a string until a particular string is entered (for example, “bye”)

    Do Not Use

    You must use the WHILE statement. You may not use any other looping mechanism.

Sample Interaction / Output

Enter a string to be repeated: coffee
How many times to show? 5

coffee
coffee
coffee
coffee
coffee

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

100  90   80   70   60   50   40   30   20   10 

Enter a number: 3
3 x 2 = 6
Enter a number: 7
7 x 2 = 14
Enter a number: -2

Enter a string: yo
Enter a string: hi
Enter a string: hola
Enter a string: sup
Enter a string: bye

In: Computer Science

In C++ Prompt user to enter two integers •Determine whether the first number is divisible by...

In C++

Prompt user to enter two integers

•Determine whether the first number is divisible by the second. If the second number is zero, the program should not do division

•Output the remainder of the two numbers

•Compare the two integers, display the integers in non-decreasing order.

In: Computer Science

public class IntNode               {            private int data;            pri

public class IntNode      
        {
           private int data;
           private IntNode link;
           public IntNode(int data, IntNode link){.. }
           public int     getData( )          {.. }
           public IntNode getLink( )           {.. }
           public void    setData(int data)     {.. }
           public void    setLink(IntNode link) {.. }
        }

All questions are based on the above class, and the following declaration.  

// Declare an empty, singly linked list with a head and a tail reference.

// you need to make sure that head always points to the head node and tail always points to the tail node.
         IntNode head, tail;
         head = tail = null;    

// 1.) Insert a node with data 2 into this empty list

// 2.) Insert a node with data 4 at the end of the list.

// 3.) Insert a node with data 3 between the first and the last node.

// 4.) Insert a node with data 1 before the first node.

// 5.) delete the node with data 2

// 6.) delete the node with data 1

In: Computer Science

1. Explain the important areas that need to be considered for a migration of web or...


1. Explain the important areas that need to be considered for a migration of web or mail services to the cloud. Why are these areas important?

2. The cloud computing model can lead to privacy compliance concerns. Provide examples of these concerns, and an analysis of the types of actions that you might take to mitigate these concerns.


5. What cloud computing best practices would you propose adopting? Why?

In: Computer Science

SUBJECT: CYBER ESSENTIALS Convert between binary and hexadecimal values Question 7: Convert binary number to a...

SUBJECT: CYBER ESSENTIALS

Convert between binary and hexadecimal values

Question 7: Convert binary number to a hexadecimal number

Binary number: 00001100

Hexadecimal value: ??

Question 8: Convert binary number to a hexadecimal number

Binary number: 01001111

Hexadecimal value: ??

Question 9: Convert binary number to a hexadecimal number

Binary number: 10101101

Hexadecimal value: ??

Question 10: Convert hexadecimal number to an 8 bit binary number

Hexadecimal number: AB

8 bit binary number:

Question 11: Convert hexadecimal number to an 8 bit binary number

Hexadecimal number: D2

8 bit binary number: ??????????

Question 12: Convert hexadecimal number to an 8 bit binary number

Hexadecimal number: 01

8 bit binary number: ??????????

Part 3: ASCII Code (10 points)

Question 13: What character is the hexadecimal ASCII code 23?

Question 14: What character is the hexadecimal ASCII code 4A?

Question 15: What character is the hexadecimal ASCII code 6A?

Part 4: Converting numbers to binary (20 points)

Question 16: For each scenario determine if the numbers should be stored as ASCII codes or binary equivalents. Then find the ASCII code or calculate the binary equivalent.

Scenario

ASCII code

Binary equivalent

The course number: 107

The year: 2001

The number of printers in inventory: 62

The weight of a suitcase when it is checked in at the airport: 24

Question 17: Explain your reason for each of the choices in the previous question.

Scenario

Binary equivalent

The course number: 107

The year: 2001

The number of printers in inventory: 62

The weight of a suitcase when it is checked in at the airport: 24

In: Computer Science

Write a Reverse Polish Calculator, RPN in JAVA Each time an operand is encountered, two values...

Write a Reverse Polish Calculator, RPN in JAVA

Each time an operand is encountered, two values are popped from this stack, the given operation is performed, and the result is pushed back onto the stack. Utilize Java generic Stack Class to implement this algorithm with four arithmetic operations: +, *, -, /.

Implement a class RPN with a single static method evaluate. This method should have the following signature:

            public static String evaluate(String expression)

It should split the passed expression into (a string array of) tokens by invoking split method of String class. This array can then be processed one element at a time (perhaps another method): each time a number is found – it is pushed on a stack. Each time an operation is found – two numbers are popped from the stack, the given operation is performed, and the result is pushed back on the stack. If the passed expression was a properly formed RPN, the last element on the stack represents the result. It should be returned as a string. If the given expression is not valid, evaluate should return a string denoting a syntax error.

Your main should continually ask the user to input a potential RPN string which would be passed to the evaluate method. In order to terminate the procedure, the user would input an empty string (carriage return).

Sample run of how it should look:

run:

Enter an RPN expression or to exit

2 3 4 +

7.0

extra junk ignored

Enter an RPN expression or to exit

2 3 4 + *

14.0

Enter an RPN expression or to exit

2 3 + +

Syntax error

Enter an RPN expression or to exit

10 6 1 - /

2.0

Enter an RPN expression or to exit

5 4 3 / /

3.75

Enter an RPN expression or to exit

  

good bye

In: Computer Science

Create an application that calculates and displays the starting and ending monthly balances for a checking...

Create an application that calculates and displays the starting and ending monthly balances for a checking account and a savings account.

Welcome to the Account application Starting Balances Checking: $1,000.00 Savings: $1,000.00 Enter the transactions for the month Withdrawal or deposit? (w/d): w Checking or savings? (c/s): c Amount?: 500 Continue? (y/n): y Withdrawal or deposit? (w/d): d Checking or savings? (c/s): s Amount?: 200 Continue? (y/n): n Monthly Payments and Fees Checking fee: $1.00 Savings interest payment: $12.00 Final Balances Checking: $499.00 Savings: $1,212.00.

  • Create interfaces named Depositable, Withdrawable, and Balanceable that specify the methods that can be used to work with accounts. The Depositable interface should include this method:

void deposit(double amount)

The Withdrawable interface should include this method:

void withdraw(double amount)

And the Balanceable interface should include these methods:

double getBalance()
void setBalance(double amount)

  • Create a class named Account that implements all three of these interfaces. This class should include an instance variable for the balance.
  • Create a class named CheckingAccount that inherits the Account class. This class should include an instance variable for the monthly fee that’s initialized to the value that’s passed to the constructor. This class should also include methods that subtract the monthly fee from the account balance and return the monthly fee.
  • Create a class named SavingsAccount that inherits the Account class. This class should include instance variables for the monthly interest rate and the monthly interest payment. The monthly interest rate should be initialized to the value that’s passed to the constructor. The monthly interest payment should be calculated by a method that applies the payment to the account balance. This class should also include a method that returns the monthly interest payment.
  • Create a class named AccountBalanceApp that uses these objects to process and display deposits and withdrawals.
  • Use the Console class presented in chapter 7 or an enhanced version of it to get and validate the user’s entries. Don’t allow the user to withdraw more than the current balance of an account.

sorry to bother i really appreciate the help could you explain step by step please and thank you.

In: Computer Science

############callbacks ##def function_1( x ) : return x ** 2 ##def function_2( x ) : return...

############callbacks

##def function_1( x ) : return x ** 2
##def function_2( x ) : return x ** 3
##def function_3( x ) : return x ** 4
##
###### create a list of callbacks to each of the functions
######by referencing their names
##
##callbacks = [ function_1 , function_2 , function_3 ]
##
######display a heading and the result of passing a value to each of the
######named functions:
##
##print( '\nNamed Functions:' )
##for function in callbacks : print( 'Result:' , function( 3 ) )
##
####Task 3. Run the code above. Understand it. Display callback for
####the situation when you need to run 2*function_1, 2*function_2,2*function_3,
####for x = 10, show that your code works.

In: Computer Science

Research Operating systems, and report on what resources you could use to get authoritative information about...

  • Research Operating systems, and report on what resources you could use to get authoritative information about mainstream modern Operating Systems.
  • Write a 1-2 page paper explaining your experience and reasons why OS analysis could benefit or has benefitted your forensic experience.

In: Computer Science

1. Write a program in C++ to find the factorial of a number. Prompt the user...

1. Write a program in C++ to find the factorial of a number. Prompt the user for a number and compute the factorial by using the following expression. Use for loops to write your solution code.
Factorial of n = n! = 1×2×3×...×n; where n is the user input.
Sample Output:
Find the factorial of a number:
------------------------------------
Input a number to find the factorial: 5
The factorial of the given number is: 120

2. Code problem 1 using While loop.

3. Write the code for a C++ program testMath.cpp that reads in two integer numbers from user input. Write the following functions in addition to the main() function for computing and returning the following to the main( ) function. 1. Function sum( ) computes and returns the sum of the two numbers, 2. Function diff( ) computes and returns the difference of the two numbers (always positive), 3. Function avg( ) computes and returns the average, 4. Function max( ) computes and returns the maximum of the two numbers 5. Function min( ) computes and returns the minimum of the two numbers   
The main( ) function performs the unit testing and tests all the functions.
Sample Output
This program reads in two integer numbers from user input
and returns their sum, difference, average, maximum and minimum.
Please enter the two numbers: 17 5
The numbers entered are 17 and 5.
The sum of 17 and 5 is: 22
The difference of 17 and 5 is: 12
The average of 17 and 5 is: 11
Fall 2019
The maximum of 17 and 5 is: 17
The minimum of 17 and 5 is: 5

In: Computer Science

Explain Ethics in research.

Explain Ethics in research.

In: Computer Science

Read in the names of several grocery items from the keyboard and create a shopping list...

Read in the names of several grocery items from the keyboard and create a shopping list using the Java ArrayList abstract data type.

Flow of Program:

1) Create a new empty ArrayList

2) Ask the user for 5 items to add to a shopping list and add them to the ArrayList (get from user via the keyboard).

3) Prompt the user for an item to search for in the list. Output a message to the user letting them know whether the item exists in the shopping list. Use a method that is part of the ArrayList class to do the search.

4) Prompt the user for an item to delete from the shopping list and remove it. (be sure to handle the case where they don’t want to delete anything). Use a method that is part of the ArrayList class to do the delete.

5) Prompt the user for an item to insert into the list. Ask them what they want to insert and where they want to insert it (after which item). Use a method that is part of the ArrayList class to do the insertion.

6) Output the final list to the user.

In: Computer Science

Task #1 – Software Sales A software company sells a package that retails for $99. Quantity...

Task #1 – Software Sales
A software company sells a package that retails for $99. Quantity discounts are given according to the following:
Quantity Discount
1 - 9 NO DISCOUNT
10 – 19 20%
20 – 49 30%
50 – 99 40%
100 or more 50%
Your program calculates the final purchase price of the software packages based on the quantity purchased. If a value of 0 or less (a negative number) is entered, display the message “Invalid Quantity” and end the program.
Input:
Ask the user to enter the quantity of packages purchased.
Process:
Calculate the subtotal (quantity * $99)
Apply the discount based on the discount schedule shown above.
Output:
Display the number of products purchased, the amount of the discount (if any) and the total amount of the purchase after the discount. Correctly format your output as currency ($xx.xx).
Sample User Input:
Enter the number of products purchased > 15
Sample User Output:
Your purchase of 15 products provides a quantity discount is 20%
Your total purchase price is $1198.00

Task #2 – The Bookseller
As a bookseller, you have a book club that awards points to its customers based on the number of books published each month.
The points awarded are as follows:
If the customer purchases 0 books, he/she earns 0 points
If the customer purchases 1 book, he/she earns 5 points
If the customer purchases 2 books, he/she earns 15 points
If the customer purchases 3 books, he/she earns 30 points
If the customer purchases 4 or more books, he/she earns 60 points
Write a program that asks the user to enter the number of books that he or she has purchased and then displays the number of points awarded. Use the SWITCH statement for this problem.
Input:
Prompt the user for the number of books purchased
Process:
Determine the number of points awarded based on the point schedule shown above
Output:
Display the number of points earned
Sample User Input:
Enter the number of books purchased > 1
Sample User Output:
You have earned 5 points

Task #3 – How much would you weigh on Mars
This task allows the user to determine how much they would weigh on any one of the planets in our Solar System.
How much you weigh depends on your mass, the mass of the planet, and the distance you are from the center of the planet. Since the various planets in our Solar System are different sizes, you will weigh less or more depending on the planet you are on. I will spare you some of the calculations and simplify it to: Weight = Mass x Surface Gravity
So, if you know your weight on Earth and the surface gravity on Earth, you can calculate your mass. You can then calculate your weight on any other planet by using the surface gravity of that planet in the same equation.

Process:
Read the Planet Name
Read your body mass
Using the Table of Mass shown below, calculate and display your weight using the equation:
Weight = Mass x Surface Gravity
Table of Surface Gravity for various planets
Mercury: 0.055
Venus: 0.82
Earth: 1.0
Mars: 0.11
Jupiter: 318
Saturn: 95.2
To simplify even further, I’m not giving you all of the planets in our Solar System.
In order to perform this task, you need some form of selection flow. The choice is up to you!
You will need to validate that a correct planet name was entered. Consider a mixed case entry of the planet – this is acceptable. However, misspellings are NOT acceptable.
If not, display a message indicating that the name entered was invalid and then exit the program!
Case 1:
Sample User Input for valid user input:
Enter the planet name> EArth
Enter your body mass (in pounds) > 100
Sample User Output:
Based on your body mass of 100, on the planet Earth, you would weigh 100 pounds

Case 2:
Sample User Input for invalid user input:
Enter the planet name> Earttttth
Enter your body mass (in pounds) > 100
Sample User Output:
You have entered an invalid planet name

Need this code in Java!

In: Computer Science