Questions
Visual Basic Your first job is to create a visual basic project that will display the...

Visual Basic

Your first job is to create a visual basic project that will display the name and telephone number for the contact person for the customer relations, marketing, order processing, and shipping departments. Include a button for each department. When the user clicks on the button for a department the program(in code for specific button will display the name and telephone number for the contact person in two labels. The same two labels will be used for each department Also include identifying labels with text "Department Contact'' and "Telephone Number". Be sure to include a button for Exit. Include a label at the bottom of the form that holds your name. Department Department Telephone Contact Custom relations Tricia Mills 500-1111• Marketing Michelle Rigner 500-2222 Order Processing Kenna DeVoes 500-3333 Shipping Eric Martin 500-4444

In: Computer Science

Can I get this logic in Python? plus what software I can use it to run?...

Can I get this logic in Python? plus what software I can use it to run?

thanks and will rate!!!

Search Lab

implement the following logic in Python, use appropriate data types. Data types are represented as either numeric (num) or string.

string name

string address

num item

num quantity

num price

num SIZE = 6

num VALID_ITEM [SIZE] = 106, 108, 307, 405, 457, 688

num VALID_ITEM_PRICE [SIZE] = 0.59, 0.99, 4.50, 15.99, 17.50, 39.00

num sub

string foundIt = “N”

string MSG_YES = “Item available”

string MSG_NO = “Item not found”

get name, address, item, quantity

sub = 0

while sub <= SIZE

if item == VALID_ITEM [sub] then

foundIt = “Y”

price = VALID_ITEM_PRICE [sub]

endif

sub = sub + 1

endwhile

if foundIt == “Y” then

print MSG_YES

print quantity, “ at “ , price, “ each”

print “Total “, quantity * price

else

print MSG_NO

endif

In: Computer Science

White the class Trace with a copy constructor and an assignment operator, printing a short message...

  1. White the class Trace with a copy constructor and an assignment operator, printing a short message in each. Use this class to demonstrate

    1. the difference between initialization

Trace t("abc");

Trace u = t;

and assignment.

Trace t("abc");

Trace u("xyz");

u = t;

  1. the fact that all constructed objects are automatically destroyed.

  2. the fact that the copy constructor is invoked if an object is passed by value to a

function.

  1. the fact that the copy constructor is not invoked when a parameter is passed

by reference.

  1. the fact that the copy constructor is used to copy a return value to the caller.

Programming language: C++

Requirement: please cover points 1-5.

In: Computer Science

IN JAVA A recursive method that takes a String as its argument and returns a list...

IN JAVA

  • A recursive method that takes a String as its argument and returns a list of Strings which includes all anagrams of the String. This method will contain a loop that generates each possible substring consisting of all but one character in the input String, ie the substring that omits the first letter, then the substring that omits the second letter, etc. Within the loop, the method calls itself recursively for each substring. For each String in the list returned by the recursive call, add the omitted character back to the end and add the String to the list to be returned. When the first instance of this method returns, the list will contain all anagrams of the original input String. It may help to work this out with a pencil and paper for a very short string (like "abc".) The most straightforward base case (termination condition for the recursion) is to return a list containing only a new empty String if the input String has length 0. If you want a challenge, try replacing this algorithm with one that uses the only recursion, with no loops.
  • A nonrecursive method that starts the recursion for the filtering step. This method will take a list of Strings, consisting of the anagrams, as its argument. Use a loop that takes each String in the list, converts it to an array of Strings using String's split() method with a blank space as the argument, and then uses the array to provide values for a list of Strings. The result of this will be a list of Strings in which each String is a word from the anagram. Still, inside the loop, call the recursive filter method for each of these Strings. In each case when it receives a non-null String as the return value fo the recursive filter method, it will add the String to the list which it returns.
  • A recursive filter method that takes a list of Strings and returns the following:
    • if all of the Strings in the list are contained in the list of valid words, return a single String made up of the Strings in the order in which they appear in the list
    • if any of the Strings in the list do not appear in the list of valid words, return null. This should be much more common than the first case.

If a list is received for which the last String is in the word list, this method should recursively call itself on a list consisting of all but the last word. If the recursive call returns a String (not null), add the last word back to the end of the String and return it. This method should not contain any loops.

In: Computer Science

100 bacteria cells are inoculated into a medium containing sufficient nutrients. Assuming it takes extactly one...

100 bacteria cells are inoculated into a medium containing sufficient nutrients. Assuming it takes extactly one hour for any cell to divide. Write a program to calculate how many hours it takes for this cell population to reach a million cells. Use python please and get exact time value for 1,000,000 cells in while or if statement

In: Computer Science

A company creates a database for its customers in which each customer is identified by their...

A company creates a database for its customers in which each customer is identified by their phone number. In this discussion, explore whether or not this is a function with your classmates. In your first post, address the following:

  1. Assign one variable as the input and the other variable as the output for this scenario. Is this relation a function? Justify your answer using the definition of a function, and explain your reasoning carefully.
  2. Do you think this is a good setup for the company’s database? Describe any pitfalls you see in this setup.
  3. Suggest an alternative identification system for the company’s database.

In: Computer Science

I'm a little confused as to what exactly I'm researching and writing about. If someone could...

I'm a little confused as to what exactly I'm researching and writing about. If someone could break it down and give me a few minor examples so I can structure the essay around it I would really appreciate it:

(Intel 80x86, ARM, MIPS R4000 )Write a two page report on the similarities and differences are of these architectures. Include in your report what you find interesting about the architectures you researched.

In: Computer Science

Given an array of Student type and size 10, create a linked list of students by...

Given an array of Student type and size 10, create a linked list of students by linking students with an odd index first and then linking students with an even index. Write a loop to print out the students in the linked list.

#include #include #include using namespace std; const int NUM = 10; struct Student{ string fName; string lName; Student * next; }; int main() { Student stuArr[NUM]; ifstream myfile; myfile.open("Test.txt"); for(int i = 0; i < NUM; i++) { myfile>>stuArr[i].fName; myfile>>stuArr[i].lName; stuArr[i].next = 0; }

In: Computer Science

INPUT FILE INTO ARRAY. CHECKING FOR COMMAS AND SUCH. HOW TO DO? void readFile(Candidate candidates[]) –...

INPUT FILE INTO ARRAY. CHECKING FOR COMMAS AND SUCH. HOW TO DO?

void readFile(Candidate candidates[]) – reads the elections.txt file, fills the candidates[] array. Hint: use substr() and find() functions. Set Score to 0.


void List(Candidate candidates[]) – prints the array of Candidate structs. One candidate per one line, include all fields. Use setw() to display nice looking list.


void displayCandidate(Candidate candidates[]) – prints the complete information about the candidate

.
Candidate First(Candidate candidates[]) – returns single struct element: candidate with highest score


Candidate Last(Candidate candidates[]) – returns single struct element: candidate with lowest score


void Votes(Candidate candidates[]) – function sorts the candidates[] array by number of votes, the order in candidates[] array is replaced


void Scores(Candidate candidates[]) – calculates the percentage score for each candidate. Use the following formula: ??????=(CandidateVotes)/(sum of votes)*100%

Correct line for the reference: F=John,L=Smith,V=3342

The line errors that your program needs to detect, are as follows:

incorrect token / separator, example in line 5: F=Steven,L=JohnV=4429 --- (comma missing) – lines with this error need to be ignored

space in token, example in line 3: F=Hillary,X=Clinton, V=1622 --- lines with this error need to be read, error fixed, data included in your dataset

empty line, example in line 6 – empty lines need to be ignored

Example Textfile

F=Michael,L=John,V=3342

F=Danny,L=Red,V=2003

F=Hillary,L=Clinton, V=1588

F=Albert,L=Lee,V=5332

F=Steven,L=JohnV=4429

*IMPORTANT* How would I do the readFile function? It says to check if the commas are present, and that the program will correct the line if there is white spaces. How do i use the find() function? Please be DETAILED in explanations of each part of code. Beginner Coder. *IMPORTANT*

Code Skeleton We HAVE to follow. How Would i go about using this skeleton? YOU CANNOT CHANGE FUNCTIONS OF VARIABLES, BUT YOU MAY ADD TO IT. THE CODE MUST HAVE WHAT IS LISTED IN THE SKELETON CODE:

#include <iostream>

#include <iomanip>

#include <stdlib.h>

#include <fstream>

#include <string>

using namespace std;

struct Candidate {
string Fname;
string Lname;
int votes;
double Score;
};

const int MAX_SIZE = 100;

void readFile(Candidate[]);

void List(Candidate[]);

void Votes(Candidate[]);

void displayCandidate(Candidate);

Candidate First(Candidate[]);

Candidate Last(Candidate[]);

void Scores(Candidate[]);

int main() {

}

void readFile(Candidate candidates[]) {

string line;

ifstream infile;

infile.open("elections.txt");

while (!infile.eof()) {

getline(infile,line);

// your code here

}

infile.close();

}

void List(Candidate candidates[]) {

}

void Votes(Candidate candidates[]) {

}

void displayCandidate(Candidate candidates) {

}

Candidate First(Candidate candidates[]) {

}

Candidate Last(Candidate candidates[]) {

}

void Scores(Candidate candidates[]) {

}

Also, how do i make verticle columbs for the display?

In: Computer Science

(C++) How do I go about obtaining the origin of a point via an instance variable?...

(C++) How do I go about obtaining the origin of a point via an instance variable?

I'm fairly new to C++ and one of my first assignments in my current class has a focus on us trying to understand headers, implementations, pointers, constructors, and the like. This particular assignment has us working with x and y coordinates. I've gotten most of this completed, but I'm not quite sure what I've done so far is going to work and there are a few parts I've completely stuck on; I haven't even been able to test this yet. Also, I apologize in advance if I'm not using the proper terminology for some of this.

There are two headers, and here is an abstract one (Point.h) that doesn't require me to edit it, but is important as a reference to the entire assignment:

    using length_unit = double;
    using coordinate_unit = double;
  
    /**
     * A Point Interface.
     */
    class Point {
    public:
        /**
         * Calculate the distance this Point is from the origin.
         * @return The distance this Point is from the origin is returned.
         */
        virtual length_unit DistanceFromOrigin() const = 0;
  
        /**
         * Calculate the distance this Point is from the given Point.
         * @param other another Point in the plane
         * @return The distance this Point is from the given Point is returned.
         */
        virtual length_unit DistanceFromPoint(const Point &other) const = 0;
  
        virtual ~Point() = default;
    };

Here's another header (TwoDimensionalPoint.h) that I was only required to add private data members with the stipulation that they have to pointers:

    #include "Point.h"
  
    /**
     * An implementation of the Point interface in a two-dimensional plane.
     */
    class TwoDimensionalPoint : public Point {
    private:
        // TODO: Add appropriate data members
        coordinate_unit *x_coordinate;
        coordinate_unit *y_coordinate;
      
    public:
        /**
         * Default/initializing constructor.
         * @param x_coordinate the x-coordinate of this Point
         * @param y_coordinate the y-coordinate of this Point
         */
        explicit TwoDimensionalPoint(coordinate_unit x_coordinate = 0, coordinate_unit y_coordinate = 0);
  
        /* The Big Five */
  
        /**
         * Destructor responsible for deleting memory occupied by the coordinates of this Point.
         */
        ~TwoDimensionalPoint() override;
  
        /**
         * Copy constructor used to create a new Point with the same coordinates of the other Point.
         * @param other a Point used as a template for creating this point using copy semantics
         */
        TwoDimensionalPoint(const TwoDimensionalPoint &other);
  
        /**
         * Move constructor used to create a new Point with the same coordinates of the other Point.
         * @param other a Point used as a template for creating this point using move semantics
         */
        TwoDimensionalPoint(TwoDimensionalPoint &&other) noexcept;
  
        /**
         * Copy assignment operator used to create a new Point with the same coordinates as the other Point.
         * @param rhs an l-value; the right-hand side of the assignment statement lhs = rhs
         * @return A new Point with the same coordinates as the given (l-value) TwoDimensionalPoint is returned.
         */
        TwoDimensionalPoint &operator=(const TwoDimensionalPoint &rhs);
  
        /**
         * Move assignment operator used to create a new Point with the same coordinates as the other Point.
         * @param rhs an r-value; the right-hand side of the assignment statement TwoDimensionalPoint lhs = TwoDimensionalPoint{x, y}
         * @return A new Point with the same coordinates as the given (r-value) TwoDimensional Point is returned.
         */
        TwoDimensionalPoint &operator=(TwoDimensionalPoint &&rhs);
  
        /* Inherited Point behavior */
  
        /**
         * @copydoc Point::DistanceFromOrigin() const
         */
        length_unit DistanceFromOrigin() const override;
  
        /**
         * @copydoc Point::DistanceFromPoint(const Point &other) const
         */
        length_unit DistanceFromPoint(const Point &other) const override;
  
        /* Specific TwoDimensionalPoint behavior */
  
        /**
         * X-coordinate accessor method.
         * @return The x-coordinate of this Point is returned.
         */
        virtual length_unit GetX() const;
  
        /**
         * Y-coordinate accessor method.
         * @return The y-coordinate of this Point is returned.
         */
        virtual length_unit GetY() const;
  
        /**
         * Assess whether this Point is the origin.
         * @return True if this Point is the origin, otherwise false.
         */
        virtual bool IsOrigin() const;
  
        /**
         * Translates this Point by the given dimensions.
         * @param x the amount to translate in the x-direction
         * @param y the amount to translate in the y-direction
         */
        void Translate(coordinate_unit x = 0, coordinate_unit y = 0);
    };

And then finally the implementation (TwoDimensionalPoint.cpp) is the meat and potatoes of what I need to do; I have to complete the areas with commented with "TODO":

    #include <algorithm>
    #include <cmath>
    #include "TwoDimensionalPoint.h"
  
    TwoDimensionalPoint::TwoDimensionalPoint(coordinate_unit x_coordinate, coordinate_unit y_coordinate) {
        // TODO: Add an appropriate initializer list
        x_coordinate = new coordinate_unit{ x_coordinate };
        y_coordinate = new coordinate_unit{ y_coordinate };
    }
  
    TwoDimensionalPoint::~TwoDimensionalPoint() {
        // TODO: Delete appropriate data members
        delete x_coordinate, y_coordinate;
    }
  
    TwoDimensionalPoint::TwoDimensionalPoint(const TwoDimensionalPoint &other) {
        // TODO: Add an appropriate initializer list
        x_coordinate = new coordinate_unit{ *other.x_coordinate };
        y_coordinate = new coordinate_unit{ *other.y_coordinate };
    }
  
    TwoDimensionalPoint::TwoDimensionalPoint(TwoDimensionalPoint &&other) noexcept {
        // TODO: Add an appropriate initializer list and appropriate body
        other.x_coordinate = nullptr;
        other.y_coordinate = nullptr;
    }
  
    TwoDimensionalPoint &TwoDimensionalPoint::operator=(const TwoDimensionalPoint &rhs) {
        // TODO: Add any appropriate code
        if (this != &rhs)
            *x_coordinate = *rhs.x_coordinate;
            *y_coordinate = *rhs.y_coordinate;
        return *this;
    }
  
    TwoDimensionalPoint &TwoDimensionalPoint::operator=(TwoDimensionalPoint &&rhs) {
        // TODO: Add any appropriate code
        std::swap(x_coordinate, rhs.x_coordinate);
        std::swap(y_coordinate, rhs.y_coordinate);
        return *this;
    }
  
    length_unit TwoDimensionalPoint::DistanceFromOrigin() const {
        // TODO: Calculate and return the correct value
        const coordinate_unit temp_x = 0 - //no idea
        const coordinate_unit temp_y = 0 - //no idea
        return sqrt( pow(temp_x, 2) + pow(temp_x, 2) );
    }
  
    length_unit TwoDimensionalPoint::DistanceFromPoint(const Point &other) const {
        // TODO: Calculate and return the correct value
        const coordinate_unit x_diff = other.GetX() - GetX();
        const coordinate_unit y_diff = other.GetY() - GetY();
        return sqrt( pow(x_diff, 2) + pow(y_diff, 2) );
    }
  
    length_unit TwoDimensionalPoint::GetX() const {
        // TODO: Return the appropriate value
        const coordinate_unit *x_coordinate = &x_coordinate;
        return *x_coordinate;
    }
  
    length_unit TwoDimensionalPoint::GetY() const {
        // TODO: Return the appropriate value
        const coordinate_unit *y_coordinate = &y_coordinate;
        return *y_coordinate;
    }
  
    bool TwoDimensionalPoint::IsOrigin() const {
        // TODO Return the correct value
        if //unfinished due to not knowing how to complete DistanceFromOrigin()
  
        else
        return false;
    }
  
    void TwoDimensionalPoint::Translate(coordinate_unit x, coordinate_unit y) {
        // TODO: Implement me
        std::cout << "X is translated by: " << x << std::endl;
        std::cout << "Y is translated by: " << y << std::endl;
    } //This part confuses me as well since there are different parameters. I.e., x and y instead of x_coordinate and y_coordinate like throughout the rest of the program.

I feel like I'm close to finishing this, but Visual Studio Code has been throwing some problems throughout this, so I'm not completely certain. I've added some of my own comments to point out areas I'm particularly stuck. Any help would be highly appreciated!

In: Computer Science

(1) Define the term identifier as a name for something, such as a variable, constant, or...

(1) Define the term identifier as a name for something, such as a variable, constant, or function.

(2) Define the term data type as a set of values together with a set of operations.

(3) Discuss the five arithmetic operators in C++ that are used to manipulate integral and floating-type data types.

In: Computer Science

C++ Write a program for sorting a list of integers in ascending order using the bubble...

C++

Write a program for sorting a list of integers in ascending order using the bubble sort algorithm

Requirements
Implement the following functions:

  1. Implement a function called readData
    int readData( int **arr)
    arr is a pointer for storing the integers. The function returns the number of integers.
    The function readData reads the list of integers from a file call data.txt into the array arr. The first integer number in the file is the number of intergers. After the first number, the file lists the integers line by line.
  2. void bsort(int *arr, int last)
    arr is a pointer to an array of integers to be sorted. last is the number of elements in the array. The function bsort sorts the list of integers in ascending order.
    Here is the Link to the Bubble Sort.
  3. writeToConsole(int * arr, int last)
    arr is a pointer to an array of integers. last is the number of elements in the array. The function writeToConsole displays the sorted list.
  4. Do not use the array notation in your solution.

Here is the content of the file data.txt.
9
8
4
7
2
9
5
6
1
3

In: Computer Science

Each player throws both dice once per turn. The player only scores when the player throws...

Each player throws both dice once per turn. The player only scores when the player throws doubles. Double-6 scores 25 points. A double-3 cancels out a player’s score and puts the score back to zero. Any double other than a 3 or 6 scores 5 points. Scores are recorded and the first player to obtain a total score of fifty points wins the game.

Write a MATLAB program to simulate the FIFTY dice game that can:

1. Play the FIFTY dice game automatically for one player using two dice.

2. Add your name, purpose, and copyright your program.

3. Clear command window and clear all variables.

4. Randomize the pseudorandom number generator with the MATLAB built-in rng function and provide ‘shuffle’ as the function input.

5. Create a variable that will keep the game score. Set the value of this variable to 0.

6. Create another variable that will count the round number. Set the value of this variable to 1.

7. Welcome the player and briefly explain how to play the game when the program starts.

8. Print the current round number in the command window.

9. Print the current game score in the command window.

10. Generate two random integers between 1 and 6 to represent the face values of two dice.

11. Print the two dice values in the command window.

12. If the value of the 1 st die and the 2nd die are not equivalent with each other: a. No action required. We can optionally display a message that no point will be added to the game score.

13. Else a. If the value of the first die is equivalent with 3: i. Display a message about rolling a double 3 causes the game score to set back to 0. ii. Set the game score to 0. b. Elseif the value of the first die is equivalent with 6: i. Display a message about rolling a double 6 adds 25 points to the game score. ii. Set the game score to game score plus 25. c. Else: i. Print a message about rolling the double dice adds 5 points to the game score. ii. Set the game score to game score plus 5. d. End.

14. End.

15. Increment the round number by 1.

16. The game should keep playing while the player’s game score is less than 50 points. Insert a while loop to wrap around the code generated from step 8 through step 15. Make the existing code generated from steps 8 through 15 the code block of this new while loop.

17. Congratulate the player and show the player’s final game score in the command window.

In: Computer Science

Java Generic 2D Linked List Problem How to convert a 1D linked List into multiple linked...

Java Generic 2D Linked List Problem

How to convert a 1D linked List into multiple linked lists with sequential values together?

//Example 1: [1,1,2,3,3] becomes [[1,1],[2],[3,3]]
//Example 1: [1,1,2,1,1,2,2,2,2] becomes [[1,1],[2],[1,1],[2,2,2,2]]
//Example 3: [1,2,3,4,5] becomes [[1],[2],[3],[4],[5]]

public <T> List<List<T>> convert2D(List<T> list) {

// Given a 1D, need to combine sequential values together.

}

In: Computer Science

6. Write a Java program to rotate an array (length 3) of integers in left direction...

6. Write a Java program to rotate an array (length 3) of integers in left direction
7. Write a Java program to store a collection of integers, sort them in ascending order and print the sorted integers.

In: Computer Science