This question need to be solved using java coading :-
I. Input All input data are from a file "in.dat". The file contains a sequence of infix form expressions, one per line. The character '$' is an end mark. For example, the following file has four infix form expressions: 1 + 2 * 3 ^ ! ( 4 == 5 ) $ 3 * ( 6 - 4 * 5 + 1) + 2 ^ 2 ^ 3 $ 77 > ( 2 - 1 ) + 80 / 4 $ ! ( 2 + 3 * 4 >= 10 % 6 ) && 20 != 30 || 45 / 5 == 3 * 3 $ Each expression is a sequence of tokens (i.e., constant integers, operators, and end mark) separated by spaces. There is no variable. II. Output Output data and related information are sent to the screen. Your program should do the following for each expression: (1) printing the expression before it is manipulated; (2) showing the converted postfix form expression; (3) showing the expression tree; (4) printing the fully parenthesized infix form expression; (5) reporting the value of the expression. III. Operators The following operators are considered. They are listed in the decreasing order of precedence. Token Operator Associativity ! logical not right-to-left ^ exponentiation right-to-left * / % multiplicative left-to-right + - additive left-to-right < <= > >= relational left-to-right == != equality left-to-right && logical and left-to-right || logical or left-to-right IV. Other Requirements Since a large amount of information are to be displayed on the screen, it is mandatory for your program to provide users a prompting message such as Press <Enter> to continue ... after each expression is processed, so that users have the chance to check the output of your program carefully. V. Algorithm: Infix_to_postfix conversion Input: An infix form expression E = t1 t2 t3 ... $, which is a sequence of tokens. Output: The postfix form expression of E. Algorithm: { do { get the next token t; case (t) { operand: place t onto the output; break; operator: while (stack s is not empty && stacktop(s) is not a left parenthesis) && precedence(stacktop(s)) >= precedence(t) // assuming left-to-right associativity, // not for the exponentiation operator ^, // which has right-to-left associativity { pop(x,s); place x onto the output; } push(t,s); break; (: push(t,s); break; ): while (stacktop(s) is not a left parenthesis) { pop(x,s); place x onto the output; } pop(x,s); break; end mark: while (stack s is not empty) { pop(x,s); place x onto the output; } place the end mark onto the output; break; } } while (t is not the end mark); }
This below is "in.dat file"
12 * 23 <= ( ( ( 3456 ) ) + ( 6789 ) ) $
1
4 ^ 3 - ( 2 + 4 * 15 ) - ( 90 / 3 != 30 ) $ 2
! ( 222 < 111 ) + 2 * 3 ^ ( 29 - 3 * 9 ) > 18 && 1234
== 1234 $ 1
( 2 * ( 62 % 5 ) ) ^ ( ( 4 - 2 ) ) - 2 ^ 2 ^ 2 $ 0
( ( 9 / ( 5 - 2 ) + 2 ) * ( 2 ^ 2 * 2 ) - 79 ) || ! ( 65432 >
54321 ) $ 1
( ( 9999 >= 8888 ) + 2 ) * ( 4 / ( 999 - 997 ) ) - 2 ^ ( 5 - 3 )
$ 2
In: Computer Science
Develop a C++ class called PrimeNumberGenerator. An object of this class will generate successive prime numbers on request. Think of the object as being similar to the digital tasbeeh counter. It has a reset button which makes the counter return to 0. There is also a button to get the next prime number. On the tasbeeh, pressing this button increments the current value of the counter. In your object, pressing this button would generate the next prime number for display. You’ll implement the reset button as a member function reset() and the other button as a function getNextPrime(). When an object is first created and the getNextPrime() function is called, it will return the first prime number, i.e., 2. Upon subsequent calls to the getNextPrime() function, the subsequent prime numbers will be returned. Define any others functions such as constructor and attributes that you need. According to Wikipedia: “a prime number is a natural number greater than 1, that has no positive divisors other than 1 and itself.”
In: Computer Science
Prove that the following language is context-free: L = { ω#x | ωR is a substring of x and x, w ∈ {0,1}* } where ωR is ω reversed.
In: Computer Science
Make a program that calculates the total of a retail sale. The program should ask the user for the following: the retail price of the item being purchased and the sales tax rate. Once the information has been entered, the program should calculate and display the following: the sales tax for the purchase and the total sale.
In: Computer Science
Write a menu-driven program to read 3 employees' information
from a text file called “ EmployeeFile” for this example but that
can be edited to add more employees later.
Each employee has a name field, ID fields, and a Salary
Record.
The Salary Record has weekly hours, rate per hour, gross salary,
Tax, and net salary field.
1.1 Implement the project with queue using pointers
1.2 Write push and pop functions for queue using pointers
C++
EmployeeField.txt example
John_Doe 123456 40 45 4500 200 4300
Billy_Bob 654321 40 200 4000 200 3800
Kate_Johnson 531642 40 300 12000 200 11800
please make sure it works on free compilers online like https://repl.it/languages/cpp to be tested.
In: Computer Science
Program description is given below!!
Client and Server Online Game Jumble: In this assignment, you need to use socket programming to implement an online game Jumble. Generate a random work in server and send it to client and ask for input and then client send the guessed word to server and server check whether its in a word.txt file and reply Win or lose.
Note:
Test your code and make sure the server can serve multiple players simultaneously. Note the words should be generated independently for each client, so that normally different clients are guessing different words
-----------------------Code--------------------
"""-----------------thread-server.py----------------------
Server side: open a socket on a port, listen for a message from a
client,
and send an echo reply; echoes lines until eof when client closes
socket;
spawns a thread to handle each client connection; threads share
global
memory space with main thread; this is more portable than fork:
threads
work on standard Windows systems, but process forks do not;
"""
import time, _thread as thread # or use
threading.Thread().start()
from socket import * # get socket constructor and constants
myHost = '' # server machine, '' means local host
myPort = 50007 # listen on a non-reserved port number
sockobj = socket(AF_INET, SOCK_STREAM) # make a TCP socket
object
sockobj.bind((myHost, myPort)) # bind it to server port
number
sockobj.listen(5) # allow up to 5 pending connects
def now():
return time.ctime(time.time()) # current time on the server
def handleClient(connection): # in spawned thread: reply
time.sleep(5) # simulate a blocking activity
while True: # read, write a client socket
data = connection.recv(1024)
if not data: break
reply = 'Echo=>%s at %s' % (data, now())
connection.send(reply.encode())
connection.close()
def dispatcher(): # listen until process killed
while True: # wait for next connection,
connection, address = sockobj.accept() # pass to thread for
service
print('Server connected by', address, end=' ')
print('at', now())
thread.start_new_thread(handleClient, (connection,))
dispatcher()
"""------------------echo-client.py-------------------------
Client side: use sockets to send data to the server, and print
server's
reply to each message line; 'localhost' means that the server is
running
on the same machine as the client, which lets us test client and
server
on one machine; to test over the Internet, run a server on a
remote
machine, and set serverHost or argv[1] to machine's domain name or
IP addr;
Python sockets are a portable BSD socket interface, with object
methods
for the standard socket calls available in the system's C
library;
"""
import sys
from socket import * # portable socket interface plus
constants
serverHost = 'localhost' # server name, or:
'starship.python.net'
serverPort = 50007 # non-reserved port used by the server
message = [b'Hello network world'] # default text to send to
server
# requires bytes: b'' or str,encode()
if len(sys.argv) > 1:
serverHost = sys.argv[1] # server from cmd line arg 1
if len(sys.argv) > 2: # text from cmd line args 2..n
message = (x.encode() for x in sys.argv[2:])
sockobj = socket(AF_INET, SOCK_STREAM) # make a TCP/IP socket
object
sockobj.connect((serverHost, serverPort)) # connect to server
machine + port
for line in message:
sockobj.send(line) # send line to server over socket
data = sockobj.recv(1024) # receive line from server: up to
1k
print('Client received:', data) # bytes are quoted, was `x`,
repr(x)
sockobj.close() # close socket to send eof to server
--------------------------jumble.py----------------------
import random
F = open('wordlist.txt')
words = F.readlines()
F.close()
while True:
word = words[random.randrange(len(words))]
while len(word) > 5 or len(word) == 0:
word = words[random.randrange(0, len(words))]
word = word.rstrip()
old_word = word
word = list(word)
while word:
print(word.pop(random.randrange(len(word))), end = ' ')
print('\nType your answer')
match_word = input()
new_word = match_word + '\n'
if new_word in words and set(match_word) == set(old_word):
print('You win.')
else:
print('The answer is ' + old_word)
-------------------wordlist.txt---------------------
ab aba abaca abacist aback abactinal abacus abaddon abaft abalienate abalienation abalone abampere abandon abandoned abandonment abarticulation abase abased abasement abash abashed abashment abasia abasic abate abatement abating abatis abatjour abattis abattoir abaxial abba
------------------------------------------------
Thank in advance! Please help me soon. I will UPVOTE!!
In: Computer Science
Consider a B-tree allowing splits and free-on-empty. Please show an example of these operations on a data structure containing 15 data items, a fanout of three, and at most three data items per node. Also give the search algorithm (use a give-up scheme).
In: Computer Science
Each ReservedRoom entry has three (data) fields:
Thus, the ReservedRoom class will consist of three data members (roomID and courseID, time), in addition to the associated methods needed as follows.
Implement the ReservedRoom ADT using Java programming language.
The RoomsBoard Class:
RoomsBoard is a singly-linked list of ReservedRoom. The class RoomsBoard supports the following operations:
Implement the RoomsBoard ADT with a singly-linked list using Java programming language. The implementation must utilize the generic class Node as described in Section 3.2.1 of your text. Figure 1 shows a sample RoomsBoard object.
Write a menu-driven program to implement a roomsboard for a classroom reservations system. The menu includes the following options:
The program will call the removeAll() method from the RoomsBoard class.
The program should handle special cases and incorrect input, and terminate safely. Examples include (but not limited to) the following:
In: Computer Science
What kind of network management protocols are available? What information can these protocols provide? Explain it with example.
In: Computer Science
What is path sensitization? Why do we do it or why it is important, explain with an example?
In: Computer Science
In: Computer Science
ONLY looking for part B!! a. Using C++, define a node structure of the linked list (e.g. value is an integer, next is a node type pointer), construct a linked list of 10 nodes and assign random numbers as the nodes’ values. Use loop to track and print from the first node to the last and output all nodes’ values. Finally, free all memories of the linked list. b. Based on 2.a, (1) define a function which takes the header as parameter, the function will create a new node and assign its value 100; then insert this node at the sixth position of the list; (2) define another function which recursively print the list forwards to verify the result; (3) define the 3rd function which takes the header as parameter, the function will delete the eighth node of the list to keep the linked list having 10 nodes, and (4) define the 4th function which recursively to print the linked list backwards. After creating the four functions, revise your program 2.a, before delete all memories of the list, call the four functions in order to verify the results.
In: Computer Science
in C++,
#include<iostream>
using namespace std;
const int NUM = 10;
void prepareArr(int a[]);
int countEven (int b[]);
int main() {
int arr[NUM];
// write a statement to call prepareArr to set values for the array
// write a statement to call countEven and print the data returned
for(int i = 0; i<NUM; i++)
cout << arr[i] <<" ";
cout <<endl;
return 0;
}
void prepareArr(int a[])
{
//randomly generate NUM integers in the range [0,99] and save them in the array parameter.
}
int countEven (int b[])
{
//count the number of even integers in the array parameter and return the number, note that the size of the array is specified with NUM.
}
Previous
In: Computer Science
Analyze the cost data below for the Costbusters Company.
Graph the percent of quality costs by product?
What are the dollar costs for each cost of quality category, by product? Graph
How might this information be used to help define a Six Sigma project?
PRODUCT A | PRODUCT B | PRODUCT C | |
Total Sales | |||
Total quality cost as a percent of sales | 24% | 19% | 15% |
External Failure | 35% | 22% | 8% |
Internal Failure | 52% | 29% | 24% |
Appraisal | 10% | 38% | 38% |
Prevention | 3% | 11% | 30% |
Can this problem be solved in minitab with graphs or Excel showing each steps? This is for my lean six sigma class
In: Computer Science
Objective: Upon completion of this program, you should gain experience with overloading basic operators for use with a C++ class.
The code for this assignment should be portable -- make sure you
test with g++ on linprog.cs.fsu.edu before you submit.
Task
Create a class called Mixed. Objects of type Mixed will store and manage rational numbers in a mixed number format (integer part and a fraction part). The class, along with the required operator overloads, should be written in the files "mixed.h" and "mixed.cpp".
Details and Requirements
Mixed m1(3, 4, 5); // sets object to 3 4/5 Mixed m2(-4, 1, 2); // sets object to -4 1/2 Mixed m3(0, -3, 5); // sets object to -3/5 (integer part is 0). Mixed m4(-1, -2, 4); // bad parameter combination. Set object to 0.
The other constructor should expect a single int parameter with a default value of 0 (so that it also acts as a default constructor). This constructor allows an integer to be passed in and represented as a Mixed object. This means that there is no fractional part. Example declarations:
Mixed m5(4); // sets object to 4 (i.e. 4 and no fractional part). Mixed m6; // sets object to 0 (default)Note that this last constructor will act as a "conversion constructor", allowing automatic type conversions from type int to type Mixed.
integer numerator/denominator
i.e. the integer part, a space, and the fraction part (in numerator/denominator form), where the integer, numerator, and denominator parts are all of type int. You may assume that this will always be the format that is entered (i.e. your function does not have to handle entry of incorrect types that would violate this format). However, this function should check the values that come in. In the case of an incorrect entry, just set the Mixed object to represent the number 0, as a default. An incorrect entry occurs if a denominator value of 0 is entered, or if an improper placement of a negative sign is used. Valid entry of a negative number should follow this rule -- if the integer part is non-zero, the negative sign is entered on the integer part; if the integer part is 0, the negative sign is entered on the numerator part (and therefore the negative sign should never be in the denominator). Examples:
Valid inputs: 2 7/3 , -5 2/7 , 4 0/7 , 0 2/5 , 0 -8/3 Invalid inputs: 2 4/0 , -2 -4/5 , 3 -6/3 , 0 2/-3
Examples: 0 , 2 , -5 , 3/4 , -6/7 , -2 4/5 , 7 2/3
Mixed m(1, 2, 3); // value is 1 2/3 Mixed z; // value is 0 Mixed r = m / z; // r is 0 (even though this is not good math)
Mixed m1(1, 2, 3); // 1 2/3 Mixed m2(2, 1, 2); // 2 1/2 cout << m1++; // prints 1 2/3, m1 is now 2 2/3 cout << ++m1; // prints 3 2/3, m1 is now 3 2/3 cout << m2--; // prints 2 1/2, m2 is now 1 1/2 cout << --m2; // prints 1/2 , m2 is now 0 1/2
In: Computer Science