Questions
Q2) How thick does paper folding get? Take one sheet out of your newspaper, and fold...

Q2) How thick does paper folding get? Take one sheet out of your newspaper, and fold it in half, then fold it in half again, and again, and again. Can you fold it 30 times? Pretending that you can (you probably can’t fold it more than 8 times), how thick would it be after 30 times? Assume the paper is 1/200 cm. thick. Write a program to solve this puzzle. Prompt for the number of folds and output the thickness in meters. Note : Run by pycharm

In: Computer Science

Hank & Sons is a retail seller of computers. At the end of the month, each...

Hank & Sons is a retail seller of computers. At the end of the month, each salesperson’s commission is calculated according to the commission table in the previous question. Salespersons also need to pay a monthly admin fee based on their total monthly sales for office supply.

For example, a salesperson with $16,000 in monthly sales will earn a 12% commission minus admin fee ($1,920 - $150). Another salesperson with $20,000 in monthly sales will earn a 15% commission minus admin fee ($3,000 - $200).

Because the staff gets paid once per month, Hank & Sons allows each employee to take up to $1,500 per month in advance. When sales commissions are calculated, the amount of each employee’s advanced pay is subtracted from the commission. If any salesperson’s commission is less than the amount of this advance, he or she must reimburse Hank & Sons for the difference.

Write the pseudo code for calculating the total monthly net income for Hank & Sons sellers. The program should first ask the user to enter the salesperson’s monthly sales and the amount of advanced pay. Then draw the flowchart for your pseudo code.

In: Computer Science

This is a very simple program that will ONLY print a heading and columns of text...

This is a very simple program that will ONLY print a heading and columns of text to emulate the following information:

Sales This Month

Admin Fee

Commission Rate

----------------------------------------------

----------------------------------------------

----------------------------------------------

Less than $10,000

$150

5%

$10,000 – 14,999

$150

10%

$15,000 – 17,999

$150

12%

$18,000 – 21,999

$200

15%

$22,000 or more

$200

16%

******Salesperson of the month******

Name: STUDENT NAME

ID: STUDENT ID

public class SalesResult {

public static void main(String[] args) {

System.out.println();

. . .

}

}

Create a Java project in Eclipse named SalesProject and add a class named SalesResult to reproduce a table like the above. In your program repeat the System.out.println(); as many times as needed.

I was wondering how to write the code to create such a table...

In: Computer Science

Why is the output for LowestSales a negative number? I am using Visual Studio. _______________________________________*_________________________________________ int...

Why is the output for LowestSales a negative number? I am using Visual Studio.

_______________________________________*_________________________________________

int main()
{
   const int STORE = 10;
   double Sales[STORE];//array for sales
   double HighestSales = Sales[], LowestSales = Sales[]; //arrays to capture highest and lowest sales
   double AverageSale = 0.00; //stores average sale amount

   for (int i = 0; i < 10; i++) // gather sales from 10 stores
   {
       cout << "Enter Store " << (i + 1) << " daily sales: \n";
       cin >> Sales[i]; //prompt the user to enter the daily sales
  
       int HighStoreNo = 0, LowStoreNo = 0; //initialize variables for high store number and low store number

       if (HighestSales > Sales[i] && (isdigit(Sales[i]) != 0) //check to see if this the highest sale, and check for positive integer
       {
           HighestSales = Sales[i]; //assign value to array member to store 'highest sales'
           HighStoreNo = i; //if highest value, assign stored value
       }
       if    (LowestSales <= Sales[i] && (isdigit(Sales[i]) != 0); //assign value to array member to store 'lowest sales'
               LowestSales = Sales[i];
               LowStoreNo = i;   //if lowest value, assign stored value
       }
  
   AverageSale += Sales[i]; //keep accumulating sales total

   }
   cout << fixed << showpoint << setprecision(2);//sets output precision to two decimals
   AverageSale = AverageSale/10; //calculate the average sale by dividing by 10 stores
  
   cout << "Highest Sale: " << HighestSales << ", Store number: " << (HighStoreNo + 1) << endl; //highest sale
   cout << "Lowest Sale: " << LowestSales << ", Store number: " << (LowStoreNo + 1) << endl; //lowest sale
   cout << "Average Sale: " << AverageSale << endl; //average sale

In: Computer Science

Write a program that loops, prompting the user for their full name, their exam result (an...

Write a program that loops, prompting the user for their full name, their exam result (an integer between 1 and 100), and then writes that data out to file called ‘customers.txt’. The program should check inputs for validity according to the following rules:

  • First and last names must use only alphabetical characters. No spaces, hyphens or special characters. Names must be less than 20 characters long.
  • Exam result (an integer between 1 and 100 inclusive)

The file should record each customers information on a single line and the output file should have the following appearance.

Nurke Fred 58

Cranium Richard 97

Write a second program that opens the ‘customers.txt’ file for reading and then reads each record, splitting it into its component fields and checking each field for validity.

The rules for validity are as in your first program, with the addition of a rule that specifies that each record must contain exactly 3 fields.

Your program should print out each valid record it reads.

The program should be able to raise an exception on invalid input, print out an error message with the line and what the error was, and continue running properly on the next line(s).

In: Computer Science

Python It's time to put everything together!  This week you will write a program that mimics an...

Python

It's time to put everything together!  This week you will write a program that mimics an online shopping cart . You will use all the programming techniques we have learned thus far this semester, including if statements, loops, lists and functions. I leave the bulk of design up to you (hint - think A LOT about it before you start programming!!) but it should include all of the following:

The basics - Add items to a cart until the user says "done" and then print out a list of items in the cart and a total price.

- Ensure the user types in numbers for quantities
- "Hardcode" the price of items into a list and pick from it randomly for each item
- Get the user's name and shipping address
- Separate functions that compute tax (bonus - different based on shipping state?) and shipping costs (based on number of items?), and returns their values to the main program
- Bonus: Set up a list of lists with all the items/prices in your store and only let users pick from that list

In: Computer Science

To play the PowerBall lottery, you buy a ticket that has five unique numbers in the...

To play the PowerBall lottery, you buy a ticket that has five unique numbers in the range of 1–69, and a “PowerBall” number in the range of 1–26. (You can pick the numbers yourself, or you can let the ticket machine randomly pick them for you.) Then, on a specified date, a winning set of numbers is randomly selected by a machine. If your first five numbers match the first five winning numbers in any order, and your PowerBall number matches the winning Pow-erBall number, then you win the jackpot, which is a very large amount of money. If your numbers match only some of the winning numbers, you win a lesser amount, depending on how many of the winning numbers you have matched. In the student sample programs for this book, you will find a file named pbnumbers.txt, containing the winning PowerBall numbers that were selected between February 3, 2010 and May 11, 2016 (the file contains 654 sets of winning numbers). Figure 8-6 shows an example of the first few lines of the file’s contents. Each line in the file contains the set of six numbers that were selected on a given date. The numbers are separated by a space, and the last number in each line is the PowerBall number for that day. For example, the first line in the file shows the numbers for February 3, 2010, which were 17, 22, 36, 37, 52, and the PowerBall number 24. Write a program that works with this file to display the 10 most common numbers, ordered by frequency.

In: Computer Science

This is a question about coding in python. I think that the question is asking me...

This is a question about coding in python. I think that the question is asking me to code the following: Implement the scalar product of 2 vectors in 2-space, using two tuple parameters (the function scalarProduct2). Write a docstring; then write some test function calls (can I pick any data for this? - the question gave these examples data examples: (1., 1.) dot (2,3) = (1.,1.) dot (2,0) = (1., 1.) dot (0,2) = (1., 1.,) dot (4,5) = ); then implement the body of the function ( I am not sure what this means - run the function?)

In: Computer Science

Perform a Web search for “Announcing the Advanced Encryption Standard (AES).” Read this document, which is...

Perform a Web search for “Announcing the Advanced Encryption Standard (AES).” Read this document, which is a FIPS 197 standard. Write a short overview of the development and implementation of this cryptosystem. Your response must include the type of Algorithm used, the size of data blocks that can be processed, and the lengths of the cipher keys.

In: Computer Science

Complete the following Lab and submit screenshots showing each step. IRC is an older application layer...

Complete the following Lab and submit screenshots showing each step.
IRC is an older application layer protocol which is the ancestor of many modern message applications. While it has greatly declined in popularity, there are still several million people using IRC.

IRC is a text only chat based protocol. There are many IRC clients you can use, and several of them are web based.

Connect to an IRC room of your choice, and post a screenshot and short description of the room and how you found it.

In: Computer Science

Problem 1: Given an array A[0 ... n-1], where each element of the array represents a...

Problem 1:

Given an array A[0 ... n-1], where each element of the array represents a vote in the election. Assume that each vote is given as integers representing the ID of the chosen candidate. Write the code determining who wins the election.

Problem 2:

How do we find the number which appeared maximum number of times in an array?

( Use Java and an original code )

In: Computer Science

I am not even sure what the question is for the problem below, but I have...

I am not even sure what the question is for the problem below, but I have highlighted what I think the question is further down:

Let v = (v1, v2) and w = (w1, w2) be vectors in 2 space.

The Scalar Product of v and whose notation is v (dot) w, is defined as follows: V (dot) w : = v1*w1 + v2 *w2

The scalar product (aka inner product, or dot product) Scalar product of 2 vectors in 2-space using 4 float parameters (the function scalarProduct 1)

ACTUAL QUESTION (I think ) - Code the following in Python:

Write a docstring; then write some test function calls; then implement the body of the function

Some test data: (1., 1.) · (2,3) = 5 (or, as a function call: scalarProduct1)

(1., 1., 2., 3.) (1.,1.) · (2,0) = 2

(1., 1.) · (0,2) =2

(1., 1.,) · (4,5) =23

In: Computer Science

For each of the following, describe how to implement the operation of the variable "int x"...

For each of the following, describe how to implement the operation of the variable "int x" using only bitwise, addition, and subtraction operators (<<, >>, +, -, &, |, ^, ~)

A) x * 2

B) x * 14

C) x * -44

D) x * 1023

Problem 2. Floating point encoding. Write out the 32 bit IEEE floating point binary representation for each of the following numbers:

A) 1.0

B) -2.0

C) -1000000.00

D) nan

E) -inf

F) 3.402823e38

In: Computer Science

You work for a bank that has a program with a dependency of the account class....

You work for a bank that has a program with a dependency of the account class. Unfortunately the hard drive that contained the source code for the account class went bad and no backup can be found. Obviously, this means you bank needs to address this issue. However, your task is to recreate the account class. The good news is that your company was able to locate a tester of the account class and one helper function to output the class. Using these two files, you should be able to re-engineer account.h and account.cpp to work as originally designed.

Implement the account class.

main.cpp:

#include <iostream>
#include "account.h"
#include "account_output.h"
using namespace std;
using namespace DS;

int main() {

    cout << "Account Tester" << std::endl;

    //Create an account with 3.0% interest rate
    account savings(0.03);
    //Deposit one dollar
    savings.deposit(1.00);
    //Account should have exactly $1 in it
    cout << savings << endl;

    //Move up a week
    savings.advanceDay(7);
    cout << savings << endl;

    //Deposit $450.55
    savings.deposit(450.55);
    cout << savings << endl;

    //Move up 23 days, should see our first compound
    //However, the average balance not 451.55, since the balance was $1 for 7 of the 30 days
    savings.advanceDay(23);
    cout << savings << endl;

    //Advance a bunch with balance unchanged, two compoudings happen
    savings.advanceDay(65);
    cout << savings << endl;

    //Deposit more
    savings.deposit(1000);
    cout << savings << endl;

    //Advance a bunch with balance unchanged, at least two more interest calculations
    savings.advanceDay(65);
    cout << savings << endl;

    //Will not mutate object, amount must be > 0
    savings.deposit(-1000);
    cout << savings << endl;

    //Will not mutate object, amount must be > 0
    savings.withdraw(-1000);
    cout << savings << endl;

    //Will not mutate object, amount must < balance
    savings.withdraw(-10000);
    cout << savings << endl;

    //lower balance by 50
    savings.withdraw(50);
    cout << savings << endl;

    savings.advanceDay(30);
    cout << savings << endl;

    return 0;
}

account_output.h: Overload of the << operator to display the balance and week number.

#ifndef PROJECT_SAVINGS_ACCOUNT_OUTPUT_H
#define PROJECT_SAVINGS_ACCOUNT_OUTPUT_H

#include <ostream>
#include <iomanip>

namespace DS {
    //Precondition: None
    //Postcondition: Output to stream, in the format of
    // day: DAYNUM, balance: $x.xx
    std::ostream &operator<<(std::ostream &, const account &);

    std::ostream &operator<<(std::ostream &os, const account &account) {
        os << "day: "
            << account.getDayNumber()
            << ", balance: $"
            << std::fixed
            << std::setprecision(2)
            << account.getBalance();
        return os;
    }
}
#endif

Due 09/17/2019 11:59pm

In: Computer Science

IN JAVA create a program that has 8 players and ranks them randomly and contains 3...

IN JAVA create a program that has 8 players and ranks them randomly and contains 3 rounds. For each round the highest ranked player plays the lowest ranked one i.e., in quarter-final round, player ranked 1 plays player ranked 8, player ranked 2 plays player ranked 7 and so on. Report the winner of each match, simulating using random values of your choice USING JAVA COLLECTIONS IS NOT ALLOWED

In: Computer Science