In: Computer Science
Make 2 hard programming (1 about pattern and 1 about anything) problem in c++ that can be solved in around 30 minute
give the problem + the answer please
i need for learning c++
In: Computer Science
Write a SuffixArray client that, given a string and an
integer L, finds all repeated substrings of length L or
more.(Please give solution in java)
In: Computer Science
Using Java
Write a program that reads a file of numbers of type int and outputs all of those numbers to another file, but without any duplicate numbers. You should assume that the input file is sorted from smallest to largest with one number on each line. After the program is run, the output file should contain all numbers that are in the original file, but no number should appear more than once. The numbers in the output file should also be sorted from smallest to largest with one number on each line.
Your program should not assume that there is a fixed number of entries to be read, but should be able to work with any number of entries in both the input and output files.
This means that you should not use arrays, lists,
arraylists,
linked lists, sets, maps, trees, or any other multi-element
data structure.
Instead, your program should read in and write out numbers from the input and output files at the same time, eliminating duplicates from the output file as you go.
Your program should obtain both file names from the user. For the original (input) file, create a text file that stores one number per line with several duplicates in sorted order. The output file should be created by your program. When completed, your program should display on the console:
|
Example:
Input File Output File
Contents Contents
1 1
3 3
3 60
3 75
60 80
60 100
75 130
75 140
75 985
80 1000
80
100
130
140
985
985
985
1000 |
Sample console dialog, where input from the user is underlined in italics
Enter input file name or full path: numbers.txt Enter output file name or full path: output.txt There were 18 numbers input, 10 output, and 8 duplicates. |
In: Computer Science
In: Computer Science
Propose two strategies that can be implemented in BCP to reduce the down time and improve the resistance of IT infrastructure
In: Computer Science
A company needs calculating the total working time of
employees in a team. You are going to help to write a program that
totals the working time in hours and minutes. You
should name your program as workingTime.py.
Your program should first ask the user how many employees there are
on the team. You may assume the value entered will not be negative,
but it could be zero. Your program will now be controlled by a loop
that asks for, and adds, the hours and minutes for each employee.
Of course the minutes will frequently add up to more than an hour,
but you should not report a total time such as 24 hours 77 minutes
for example (or worse, 18 hours 377 minutes). Instead you should
report the total time as 25 hours 17 minutes . On the other hand,
if the total number of hours is 24 or greater you should not report
the time in days, hours and minutes. Hours and minutes
are all that are to be reported.
While you may assume that all of the hours and minutes entered by the user will be nonnegative, a time may be entered with minutes that exceed 60. Your program should be able to handle this and still report the total correctly. For example, 5 hours, 65 minutes and 3 hours, 88 minutes should add up to 10 hours, 33 minutes. Consequently for a given team we should see output such as:
Total time: 29 hours 18 minutes
Note: 1. The number 29 and 18
is calculated based on the user’s input.
2. If you already know about conditionals, you may not use them in
this program.
In part II, the company needs to calculate the total working time for employees from all teams in days, hours, and minutes. Users of the program report that they do not like having to start the program over and over to process multiple teams, so we are going to fix that complaint.
Add code to first ask how many teams are to be processed (you may assume the value entered is non-negative). Use this number to determine how many times the program will go through one loop (known as an outer loop) that contains within it the code from part 1. Since the loop from the code of part 1 will now lie within the loop you are developing for this part of the assignment, it is known as the inner loop. At the end of each pass of the outer loop your program should identify the team being processed as Team1, Team2, etc. and then report the total time of that Team. Thus we may see output such as:
Team1 Total time: 29 hours 18 minutes
Team2 Total time: 27 hours 49 minutes
Team3 Total time: 15 hours 1 minutes
Finally, add code to output the total time of all of the teams entered. Thus, the last line of output may be: Total time of all teams: 3 days 0 hours 8 minutes Note that the total time for all teams should display the number of days, hours, and minutes.
If you already know about conditionals, you may not use them in this program.
In: Computer Science
Abstraction is the basis for good Object-Oriented design that is modular, reusable, and maintainable.
Interfaces and Abstract classes are two mechanisms in Java that provide high-level abstractions. An interface or abstract class is something which is not concrete, something which is incomplete.
For this discussion, what do you think is meant by “Programming to an interface”? What are some differences between Abstract Classes and Interfaces? Provide a simple example application with an interface definition and a class which implements the interface.
In: Computer Science
Give pseudocode to implement a phase of Boruvka’s algorithm. Argue that ˙ the running time of your implementation is O(m)
In: Computer Science
write a java programming using 2D arrey.
The Lo Shu Magic Square is a grid with 3 rows and 3 columns. The Lo
Shu Magic Square has the following properties:
The grid contains the numbers 1 through 9 (each number only once)
The sum of each row, each column and each diagonal are the same
In a program you can simulate a magic square using a two-dimensional array. Write a method that accepts a two-dimensional array as an argument, and determines whether the array is a Lo Shu Magic Square. Test the function in a program.
Detailed Description:
In main create two arrays:
// Create a magic two-dimensional array.
int[][] magicArray = { {4, 9, 2},
{3, 5, 7},
{8, 1, 6} };
// Create a normal two-dimensional array.
int[][] normalArray = { {1, 2, 3},
{4, 5, 6},
{7, 8, 8} };
For the normalArray call showArray and then showResult. Then do the same for magicArray
showArray accepts a two-dimensional array and prints it row by row
showResult call isMagicSquare with the two-dimensional array reference as the parameter. It prints a message based on the return value which is Boolean.
The isMagicSquare method accepts a two-dimensional int array as an argument, and returns true if the array meets all the requirements of a magic square. Otherwise it returns false. You can create separate methods to checkRange (all must be from 1-9), checkUnique (see if all values are unique), checkRowSum, checkColSum, checkDiagSum. If each of these 3 return true then it is a Magic Square.
Output should be
1 2 3
4 5 6
7 8 8
This is not a Lo Shu magic square.
4 9 2
3 5 7
8 1 6
This is a Lo Shu magic square.
In: Computer Science
Have insufficient privileges to install the program. What is wrong?
In: Computer Science
With four Boolean inputs mentioned in the first four columns of the following table, report the outputs from the circuits described by the Boolean expressions in the topmost row of the table in the 5th and 6th columns, in the corresponding rows in the 5th and 6th columns of the table. The circuit in the 5th column uses two AND gates, two NOT gates, and one OR gate. The circuit in the 6th column uses two AND gates and one OR gate. You can draw the circuits or construct partial truth tables which have just the given combinations of input values instead of the 16 possible combinations, if you wish. You can also find the answers by simply using the meaning of AND, OR, and NOT gates.
|
X1 |
X2 |
X3 |
X4 |
NOT(X1) AND ((X2 OR X3) AND (NOT(X4))) |
(X1 AND X2) OR (X3 AND X4) |
|
0 |
0 |
0 |
0 |
||
|
1 |
1 |
0 |
0 |
||
|
0 |
1 |
1 |
0 |
In: Computer Science
a. In your own words, define the concept of "Recursion" in terms of C++ programming.
b. In your own words, define the concept of "infinite recursion".
c. In your own words, define "mutual recursion" as it pertains to C++ programming.
In: Computer Science
Write a program that creates a two-dimensional array initialized with test data. Use any
primitive data type that you wish. The program should have the following methods:
Demonstrate each of the methods in this program. Each (except for getElementCount, are called from main.
The main program will request the number of rows and columns as input, creates the two-dimensional array, and first calls fillRandom. A sample output is:
Please enter the number of rows and columns in a two dimensional array: 4 5
78 65 72 30 95
60 71 88 41 73
32 74 47 70 27
59 91 80 81 87
Output:
Processing the int array.
Total : 1321
Average : 66.05
Total of row 0 : 340
Highest in row 0 : 95
Lowest in row 0 : 30
Total of row 1 : 333
Highest in row 1 : 88
Lowest in row 1 : 41
Total of row 2 : 250
Highest in row 2 : 74
Lowest in row 2 : 27
Total of row 3 : 398
Highest in row 3 : 91
Lowest in row 3 : 59
In: Computer Science
Write a java project that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals (sample input data is attached). Store the data in an object designed to store a first name (string), last name (string), and postal code (integer). Assume each line of input will contain two strings followed by an integer value, each separated by a tab character. Then, after the input has been read in, print the list in an appropriate format to the screen. It should also Support the storing of additional user information: street address (string), city( string), state (string), and 10-digit phone number (long integer, contains area code and does not include special characters such as '(', ')', or '-'. Need to Store the data in an ArrayList object
In: Computer Science