logic
.cpp
keyboard_arrow_up
School
Texas A&M University *
*We aren’t endorsed by this school
Course
121
Subject
Computer Science
Date
Jun 13, 2024
Type
cpp
Pages
6
Uploaded by CoachElement14434
#include <iostream>
#include <fstream>
#include <string>
#include "logic.h"
using std::cout, std::endl, std::ifstream, std::string;
/**
* TODO: Student implement this function
* Load representation of the dungeon level from file into the 2D map.
* Calls createMap to allocate the 2D array.
* @param fileName File name of dungeon level.
* @param maxRow Number of rows in the dungeon table (aka height).
* @param maxCol Number of columns in the dungeon table (aka width).
* @param player Player object by reference to set starting position.
* @return pointer to 2D dynamic array representation of dungeon map with player's
location., or nullptr if loading fails for any reason
* @updates maxRow, maxCol, player
*/
char** loadLevel(const string& fileName, int& maxRow, int& maxCol, Player& player) {
bool valid = false;
ifstream input_file(fileName);
if (!input_file.is_open()){
return nullptr;
}if (!(input_file>> maxRow >> maxCol)){ return nullptr;
}if (maxRow <= 0 || maxCol <= 0 || maxRow > (INT32_MAX/maxCol) || maxCol > 999999 || maxRow > 999999){
return nullptr;
}
char** gamemap = createMap(maxRow, maxCol);
if (!gamemap){
return nullptr;
}
if(!(input_file >> player.row >> player.col)){
return nullptr;
}if ( player.col < 0 || player.col >= maxCol || player.row<0 || player.row >= maxRow){
deleteMap(gamemap, maxRow);
return nullptr;
}
for (int row = 0; row < maxRow; ++row){
for(int col = 0; col < maxCol; ++col){
char tile;
if (!(input_file >> tile)){
deleteMap(gamemap, maxRow);
return nullptr;
}
gamemap[row][col]=tile;
if(!(tile == TILE_AMULET || tile == TILE_EXIT || tile == TILE_MONSTER || tile == TILE_DOOR || tile == TILE_OPEN || tile == TILE_PILLAR || tile == TILE_TREASURE)){
deleteMap(gamemap, maxRow);
return nullptr;
}if (tile == TILE_EXIT || tile == TILE_DOOR){
valid = true;
}
}
} if (valid == false){
deleteMap(gamemap, maxRow);
return nullptr;
}
char extravalue;
if (input_file >> extravalue){
deleteMap(gamemap, maxRow);
return nullptr;
}if (gamemap[player.row][player.col] == TILE_OPEN){
gamemap[player.row][player.col] = TILE_PLAYER;
}else{
deleteMap(gamemap, maxRow);
return nullptr;
}
input_file.close();
return gamemap;
}
/**
* TODO: Student implement this function
* Translate the character direction input by the user into row or column change.
* That is, updates the nextRow or nextCol according to the player's movement direction.
* @param input Character input by the user which translates to a direction.
* @param nextRow Player's next row on the dungeon map (up/down).
* @param nextCol Player's next column on dungeon map (left/right).
* @updates nextRow, nextCol
*/
void getDirection(char input, int& nextRow, int& nextCol) {
if(input == MOVE_UP){
nextRow += -1;
nextCol += 0;
}else if(input == MOVE_DOWN){
nextRow += 1;
nextCol += 0;
}else if(input == MOVE_LEFT){
nextCol += -1;
nextRow += 0;
}else if(input == MOVE_RIGHT){
nextCol += 1;
nextRow += 0;
}else{
nextCol += 0;
nextRow += 0;
}
}
/**
* TODO: [suggested] Student implement this function
* Allocate the 2D map array.
* Initialize each cell to TILE_OPEN.
* @param maxRow Number of rows in the dungeon table (aka height).
* @param maxCol Number of columns in the dungeon table (aka width).
* @return 2D map array for the dungeon level, holds char type.
*/
char** createMap(int maxRow, int maxCol) {
if(maxCol <= 0 || maxRow <= 0){
return nullptr;
}
char** gamemap = new char*[maxRow];
for (int row = 0; row < maxRow; ++row){
gamemap[row] = new char [maxCol];
}for (int row = 0; row < maxRow; row++){
for(int col = 0; col < maxCol; col++){
gamemap[row][col] = TILE_OPEN;
}
}
return gamemap;
}
/**
* TODO: Student implement this function
* Deallocates the 2D map array.
* @param map Dungeon map.
* @param maxRow Number of rows in the dungeon table (aka height).
* @return None
* @update map, maxRow
*/
void deleteMap(char**& map, int& maxRow) {
if((map != nullptr) && (maxRow >0)){
for(int row = 0; row < maxRow; row++){
delete[] map[row];
}
delete[] map;
}
map = nullptr;
maxRow = 0;
}
/**
* TODO: Student implement this function
* Resize the 2D map by doubling both dimensions.
* Copy the current map contents to the right, diagonal down, and below.
* Do not duplicate the player, and remember to avoid memory leaks!
* You can use the STATUS constants defined in logic.h to help!
* @param map Dungeon map.
* @param maxRow Number of rows in the dungeon table (aka height), to be doubled.
* @param maxCol Number of columns in the dungeon table (aka width), to be doubled.
* @return pointer to a dynamically-allocated 2D array (map) that has twice as many columns and rows in size.
* @update maxRow, maxCol
*/
char** resizeMap(char** map, int& maxRow, int& maxCol) {
int nuevomax_row = maxRow * 2;
int nuevomax_col = maxCol * 2;
if (map == nullptr || maxCol < 1 || maxRow < 1){
return nullptr;
}
char** new_map = createMap(nuevomax_row, nuevomax_col);
for (int row = 0; row < maxRow; row++){
for (int col = 0; col < maxCol; col++){
new_map[row][col] = map[row][col];
if (map[row][col] == TILE_PLAYER){
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
struct nodeType {
int infoData;
nodeType * next;
};
nodeType *first;
… and containing the values(see image)
Using a loop to reach the end of the list, write a code segment that deletes all the nodes in the list. Ensure the code performs all memory ‘cleanup’ functions.
arrow_forward
Doctor
-signature:String
-doctorID:int
- medicine:Arraylist
+Doctor(signature:String,doctorID:int)
+PrescribeMedicine():void
+ salary ()
+checkRecords():void
Medicine
Pharmacist
-medName:String
-startTime:int
-dosage :int
-endTime:int
-date_prescribed:int
- medicine:Arraylist
+Medicine(medName:String,-dosage :int,date_prescribed:int)
+Pharmacist (startTime:int,endTime:int)
+checkForConflict():double
+confirm_prescription():String
+getStartTime():int
+getEndTime():int
+setStartTime(time:int):void
+setEndTime(time1:int).void
arrow_forward
c++
arrow_forward
Concatenate Map
This function will be given a single parameter known as the Map List. The Map List is a list of maps. Your job is to combine all the maps found in the map list into a single map and return it. There are two rules for addingvalues to the map.
You must add key-value pairs to the map in the same order they are found in the Map List. If the key already exists, it cannot be overwritten. In other words, if two or more maps have the same key, the key to be added cannot be overwritten by the subsequent maps.
Signature:
public static HashMap<String, Integer> concatenateMap(ArrayList<HashMap<String, Integer>> mapList)
Example:
INPUT: [{b=55, t=20, f=26, n=87, o=93}, {s=95, f=9, n=11, o=71}, {f=89, n=82, o=29}]OUTPUT: {b=55, s=95, t=20, f=26, n=87, o=93}
INPUT: [{v=2, f=80, z=43, k=90, n=43}, {d=41, f=98, y=39, n=83}, {d=12, v=61, y=44, n=30}]OUTPUT: {d=41, v=2, f=80, y=39, z=43, k=90, n=43}
INPUT: [{p=79, b=10, g=28, h=21, z=62}, {p=5, g=87, h=38}, {p=29,…
arrow_forward
Unique Words
Summary Specifications:You are tasked to implement an abstract data type class which takes in a given input file called input.txt, and processes, identifies and sorts all unique word instances found in the file.
Sample InputHi hello hi good bye goodbye Bye bye good say
Sample OutputBye Hi bye hello hi say
The input.txt file is found along with the zip folder where this instructions file also came along with.
Note: you are not allowed to use pythonic lists, and its methods and functions, and string methods.
However the use of the file handling methods (read readlines and readline) are allowed for this project.
arrow_forward
gui
ava - explain what this lone of code means
void overrideProgramParameters (Map<String, String> clientParameters, ValueBean valueBean) ;
arrow_forward
main.cc file
#include <iostream>#include <memory>
#include "train.h"
int main() { // Creates a train, with the locomotive at the front of the train. // LinkedList diagram: // Locomotive -> First Class -> Business Class -> Cafe Car -> Carriage 1 -> // Carriage 2 std::shared_ptr<Train> carriage2 = std::make_shared<Train>(100, 100, nullptr); std::shared_ptr<Train> carriage1 = std::make_shared<Train>(220, 220, carriage2); std::shared_ptr<Train> cafe_car = std::make_shared<Train>(250, 250, carriage1); std::shared_ptr<Train> business_class = std::make_shared<Train>(50, 50, cafe_car); std::shared_ptr<Train> first_class = std::make_shared<Train>(20, 20, business_class); std::shared_ptr<Train> locomotive = std::make_shared<Train>(1, 1, first_class);
std::cout << "Total passengers in the train: "; // =================== YOUR CODE HERE…
arrow_forward
Opengl Help
Programming Language: c++
I need help setting coordinate boundries for this program so the shape can't leave the Opengl window. The shape needs to stay visiable.
arrow_forward
In a new file named runner.cpp, define the Runner class, whose purpose is to
hold the profile data for a user and maintain a record of their activities. The
Runner class should have the following members
• private variables for: username (string), age (integer, in years), weight
(integer, in kg), height (integer, in cm), runList (list container of Run
objects 2)
arrow_forward
in C++ write a “serialize” and “deserialize” function for a map.
arrow_forward
Task 4. Utility classes
Implement a Menu-Driven program of ArrayList class using the above scenario and perform the following operations.
Create an object of ArrayList class based on the scenario with explanations of the method
Create a method that will allow inserting an element to ArrayList Class based on the scenario. The input field must be validated as
Create a method to delete specific elements in the ArrayList with explanations of the method
arrow_forward
What function does this Syntax perform?
function myMap() {var map Canvas = document.getElementById("map");var mapOptions = {center: new google.maps.LatLng(51.5, -0.2),zoom: 10};var map = new google.maps.Map(mapCanvas, mapOptions);}
arrow_forward
Fix an error and show it please?
arrow_forward
A map interface's list collection views
arrow_forward
function loginValidate () {
var id = document.getElementById ('myid').value;
var pass = document.getElementById('mypassword').value;
if ((id == null : id
alert ("ID and Pasword both must be filled out") :
"") && (pass == null , pass ==
")){
==
return false:
else if (id == null || id ==
"") {
alert ("ID must be filled out ");
return false;
else if (pass == null || pass ==
"") {
alert ("Password must be filled out ");
return false;
arrow_forward
In C++.
arrow_forward
Write the definitions of the functions to overload the assignment operator and copy constructor for the class queueType.
Also, write a program (in main.cpp) to test these operations.
HEADER FILE FOR queueAsArray.h
//Header file QueueAsArray
#ifndef H_QueueAsArray
#define H_QueueAsArray
#include<iostream>
#include <cassert>
#include "queueADT.h"
using namespace std;
template <class Type>
class queueType: public queueADT<Type>
{
public:
const queueType<Type>& operator=(const queueType<Type>&);
//Overload the assignment operator.
bool isEmptyQueue() const;
//Function to determine whether the queue is empty.
//Postcondition: Returns true if the queue is empty,
// otherwise returns false.
bool isFullQueue() const;
//Function to determine whether the queue is full.
//Postcondition: Returns true if the queue is full,
// otherwise returns false.
void initializeQueue();
//Function to initialize the queue to an empty state.
//Postcondition:…
arrow_forward
# define stemmer functionstemmer = SnowballStemmer('english')
# tokenise datatokeniser = TreebankWordTokenizer()tokens = tokeniser.tokenize(data)
# define lemmatiserlemmatizer = WordNetLemmatizer()
# bag of wordsdef bag_of_words_count(words, word_dict={}): """ this function takes in a list of words and returns a dictionary with each word as a key, and the value represents the number of times that word appeared""" for word in words: if word in word_dict.keys(): word_dict[word] += 1 else: word_dict[word] = 1 return word_dict
# remove stopwordstokens_less_stopwords = [word for word in tokens if word not in stopwords.words('english')]
# create bag of wordsbag_of_words = bag_of_words_count(tokens_less_stopwords)
Use the stemmer and lemmatizer functions (defined in the cells above) from the relevant library to find the stem and lemma of the nth word in the token list.
Function Specifications:
Should take a list as input and…
arrow_forward
Collection: List, Set and Map. Collection operations on primitives and custom object
(Eg: For custom object Student having properties ID and Name)
List , Set , Map
arrow_forward
This is hard help please its from my study guide in C++ LEVEL 2
arrow_forward
Two-dimensional list tictactoe represents a 3x3 tic-tac-toe game board read from input. List tictactoe contains three lists, each representing a row. Each list has three elements representing the three columns on the board. Each element in the tic-tac-toe game board is 'x', 'o', or '-'.
If all the elements at column index 0 are 'o', output 'A win at column 0.' Otherwise, output 'No win at column 0.'
arrow_forward
public void enableselectors()
{
// need help
// this code will need to use the _selectors map that will already be created and filled
}
make this code actually enable or disable the selectors
/**
disable all the selectors
*/
public void disableselectors()
{
// need help -- make this code actually disable all the selectors
// this code will need to use the _selectors map that will already be created and filled
}
arrow_forward
#include <bits/stdc++.h>#include<unordered_map>#include <string>
using namespace std;
struct Student{string firstName;string lastName;string studentId;double gpa;};
class MyClass{public:unordered_map<string, int>classHoursInfo;vector<Student> students;unordered_map<string, int> creditValue = {{"A", 4}, {"B", 3}, {"C", 2}, {"D", 1}, {"F", 0}};
void readStudentData(string filepath){cout << "reading student data \n";ifstream inpStream(filepath);string text;string tmp[4];while (getline (inpStream, text)) {string str = "", prevKey = ""; int j= 0;unordered_map<string, int> curStudentClassInfo;for(int i=0; i<text.length(); i++){if(isspace(text[i])){if(j>3){if(prevKey.length()==0){curStudentClassInfo[str] = 0;prevKey = str;str.clear();}else{curStudentClassInfo[prevKey] = creditValue[str];prevKey = "";str.clear();}}else{tmp[j++] = str;str.clear();}}else{str = str+text[i];}}if(str.length() != 0){curStudentClassInfo[prevKey] =…
arrow_forward
Q1
function myFunc() {
let a = 10;
if (true) {
Q3
}
}
let a = 5;
console.log(a);
Q4
console.log(a);
Q2
const square = num => num * num;
console.log(square(3) + 5);
myFunc();
let x = 30;
let y
"200";
console.log(x+y);
const nums = [10, 20, 8, 17];
nums.filter(e=> e > 10);
console.log(nums);
Q5
const nums = [30, 35, 42, 20, 15];
console.log(nums.every (num
=> num > 20));
January 15
arrow_forward
Observer pattern
The PhoneModel class stores a phone number as a list of digits, and the Keypad class has this method:
public void simulateKeyPresses(int numKeyPresses)(0
that allows the user to enter digits one at a time then save each digit in the list.
The Screen wants to respond to each key being entered.
Make the model notify the observers whenever a new digit is entered for the phone number.
The first observer prints the newest digit out to the screen
The second observer prints "Now dialing 12345678901.." out to the screen (where the number is the
number the model has).
Only the Screen class can print to the screen
The model must be decoupled from the Other classes.
arrow_forward
struct insert_at_back_of_dll {
// Function takes a constant Book as a parameter, inserts that book at the
// back of a doubly linked list, and returns nothing.
void operator()(const Book& book) {
/ // TO-DO (2) ||||
// Write the lines of code to insert "book" at the back of "my_dll".
//
// // END-TO-DO (2) |||
}
std::list& my_dll;
};
arrow_forward
String Pair
// Problem Description
// One person hands over the list of digits to Mr. String, But Mr. String understands only strings. Within strings also he understands only vowels. Mr. String needs your help to find the total number of pairs which add up to a certain digit D.
// The rules to calculate digit D are as follow
// Take all digits and convert them into their textual representation
// Next, sum up the number of vowels i.e. {a, e, i, o, u} from all textual representation
// This sum is digit D
// Now, once digit D is known find out all unordered pairs of numbers in input whose sum is equal to D. Refer example section for better understanding.
// Constraints
// 1 <= N <= 100
// 1 <= value of each element in second line of input <= 100
// Number 100, if and when it appears in input should be converted to textual representation as hundred and not as one hundred. Hence number…
arrow_forward
True or true: False or true: Map-reduce is just applications.
arrow_forward
C Language
Title : Tennis Game
arrow_forward
dict_graph = {}
# Read the data.txt file
with open('data.txt', 'r') as f:
for l in f:
city_a, city_b, p_cost = l.split()
if city_a not in dict_graph:
dict_graph[city_a] = {}
dict_graph[city_a][city_b] = int(p_cost)
if city_b not in dict_graph:
dict_graph[city_b] = {}
dict_graph[city_b][city_a] = int(p_cost)
# Breadth First Search Method
def BreadthFirstSearch(graph, src, dst):
q = [(src, [src], 0)]
visited = {src}
while q:
(node, path, cost) = q.pop(0)
for temp in graph[node].keys():
if temp == dst:
return path + [temp], cost + graph[node][temp]
else:
if temp not in visited:
visited.add(temp)
q.append((temp, path + [temp], cost + graph[node][temp]))
# Depth First Search Method
def DepthFirstSearch(graph, src, dst):
stack = [(src, [src], 0)]
visited = {src}
while stack:…
arrow_forward
Practice / Frequency of Characters
Write a method that returns the frequency of each characters of a given String parameter.
If the given String is null, then return null
If the given String is empty return an empty map
Example
input:
output: empty map
explanation: input is empty
Example
input: null
output: null
explanation: input is null.
Since problem output is focused on the frequency we can
comfortably use Map data structure. Because we can use
characters as key and the occurrences of them as value.
Example
input: responsible
output: {r=1, e=2, s=2, p=1,
o=1, n=1, i=1, b=1, l=1}
explanation: characters are
keys and oc
values
ences are
arrow_forward
C++ ProgrammingActivity: Deque Linked List
Explain the flow of the code not necessarily every line, as long as you explain what the important parts of the code do. The code is already correct, just explain the flow.
#include "deque.h"
#include "linkedlist.h"
#include <iostream>
using namespace std;
class DLLDeque : public Deque {
DoublyLinkedList* list;
public:
DLLDeque() {
list = new DoublyLinkedList();
}
void addFirst(int e) {
list->addAt(e,1);
}
void addLast(int e) {
list->addAt(e,size()+1);
}
int removeFirst() {
return list->removeAt(1);
}
int removeLast() {
return list->removeAt(size());
}
int size(){
return list->size();
}
bool isEmpty() {
return list->isEmpty();
}
// OPTIONAL: a helper method to help you debug
void print() {…
arrow_forward
igure
Boer D tanon
--> x = linspace (-20,20, 1000);
--> yl - x. *sin (x);
--> y2 - -x;
--> plot (x, y1, 'b',x, y2, 'r');
--> xtitle('Graph', 'axe x','axe y');
--> legend ('y1=x*sin (x)', 'y2=-x');
Q1. What is the output of the above scripts?
Q2. Plot graphs for the following time-domain function:
i.
e-2t +e-4t
ii.
e-t + e3t
ii.
e2t +e-5t + sin(3t)
iv.
e-2t + te-2t + sin(5t)
Q3. From the graph, observe the above functions are stable or unstable?
arrow_forward
1- The FloatArray class stores a dynamic array of floats and its size. It has:- A parameterized constructor that takes the array size. - An add method that adds a float at the end of the array.- Overloading for the insertion operator << to write the array to afile (ofstream)- Overloading for the extraction operator >> to read the array elements from the file (ifstream) and add them to the array.- A destructor to deallocate the array2- The SortedArray inherits from FloatArray. It has:- A parameterized constructor that takes the array size. - An add method that adds a float at the right place in the arraysuch that the array remains sorted with every add. Don’t add to the array then sort but rather add in the right place.3- The FrontArray inherits from FloatArray. It has:- A parameterized constructor that takes the array size. - An add method that adds a float at the front of the array.4- The PositiveArray that inherits from SortedArray. It has:- A parameterized constructor…
arrow_forward
Course: Data Structure and Algorithims
Language: Java
Kindly make the program in 2 hours.
Task is well explained.
You have to make the proogram properly in Java:
Restriction: Prototype cannot be change you have to make program by using given prototype.
TAsk:
Create a class Node having two data members
int data;
Node next;
Write the parametrized constructor of the class Node which contain one parameter int value assign this value to data and assign next to null
Create class LinkList having one data members of type Node.
Node head
Write the following function in the LinkList class
publicvoidinsertAtLast(int data);//this function add node at the end of the list
publicvoid insertAthead(int data);//this function add node at the head of the list
publicvoid deleteNode(int key);//this function find a node containing "key" and delete it
publicvoid printLinkList();//this function print all the values in the Linklist
public LinkListmergeList(LinkList l1,LinkList l2);// this function…
arrow_forward
card_t * moveCardBack (card t *head);
The moveCardBack function will take the card in front of the pile and place it in the back. In coding
terms, you are taking the head of the linked list and moving it to the end. The function has one parameter
which is the head of the linked list. After moving the card to the back, the function returns the new head
of the linked list.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- struct nodeType { int infoData; nodeType * next; }; nodeType *first; … and containing the values(see image) Using a loop to reach the end of the list, write a code segment that deletes all the nodes in the list. Ensure the code performs all memory ‘cleanup’ functions.arrow_forwardDoctor -signature:String -doctorID:int - medicine:Arraylist +Doctor(signature:String,doctorID:int) +PrescribeMedicine():void + salary () +checkRecords():void Medicine Pharmacist -medName:String -startTime:int -dosage :int -endTime:int -date_prescribed:int - medicine:Arraylist +Medicine(medName:String,-dosage :int,date_prescribed:int) +Pharmacist (startTime:int,endTime:int) +checkForConflict():double +confirm_prescription():String +getStartTime():int +getEndTime():int +setStartTime(time:int):void +setEndTime(time1:int).voidarrow_forwardc++arrow_forward
- Concatenate Map This function will be given a single parameter known as the Map List. The Map List is a list of maps. Your job is to combine all the maps found in the map list into a single map and return it. There are two rules for addingvalues to the map. You must add key-value pairs to the map in the same order they are found in the Map List. If the key already exists, it cannot be overwritten. In other words, if two or more maps have the same key, the key to be added cannot be overwritten by the subsequent maps. Signature: public static HashMap<String, Integer> concatenateMap(ArrayList<HashMap<String, Integer>> mapList) Example: INPUT: [{b=55, t=20, f=26, n=87, o=93}, {s=95, f=9, n=11, o=71}, {f=89, n=82, o=29}]OUTPUT: {b=55, s=95, t=20, f=26, n=87, o=93} INPUT: [{v=2, f=80, z=43, k=90, n=43}, {d=41, f=98, y=39, n=83}, {d=12, v=61, y=44, n=30}]OUTPUT: {d=41, v=2, f=80, y=39, z=43, k=90, n=43} INPUT: [{p=79, b=10, g=28, h=21, z=62}, {p=5, g=87, h=38}, {p=29,…arrow_forwardUnique Words Summary Specifications:You are tasked to implement an abstract data type class which takes in a given input file called input.txt, and processes, identifies and sorts all unique word instances found in the file. Sample InputHi hello hi good bye goodbye Bye bye good say Sample OutputBye Hi bye hello hi say The input.txt file is found along with the zip folder where this instructions file also came along with. Note: you are not allowed to use pythonic lists, and its methods and functions, and string methods. However the use of the file handling methods (read readlines and readline) are allowed for this project.arrow_forwardgui ava - explain what this lone of code means void overrideProgramParameters (Map<String, String> clientParameters, ValueBean valueBean) ;arrow_forward
- main.cc file #include <iostream>#include <memory> #include "train.h" int main() { // Creates a train, with the locomotive at the front of the train. // LinkedList diagram: // Locomotive -> First Class -> Business Class -> Cafe Car -> Carriage 1 -> // Carriage 2 std::shared_ptr<Train> carriage2 = std::make_shared<Train>(100, 100, nullptr); std::shared_ptr<Train> carriage1 = std::make_shared<Train>(220, 220, carriage2); std::shared_ptr<Train> cafe_car = std::make_shared<Train>(250, 250, carriage1); std::shared_ptr<Train> business_class = std::make_shared<Train>(50, 50, cafe_car); std::shared_ptr<Train> first_class = std::make_shared<Train>(20, 20, business_class); std::shared_ptr<Train> locomotive = std::make_shared<Train>(1, 1, first_class); std::cout << "Total passengers in the train: "; // =================== YOUR CODE HERE…arrow_forwardOpengl Help Programming Language: c++ I need help setting coordinate boundries for this program so the shape can't leave the Opengl window. The shape needs to stay visiable.arrow_forwardIn a new file named runner.cpp, define the Runner class, whose purpose is to hold the profile data for a user and maintain a record of their activities. The Runner class should have the following members • private variables for: username (string), age (integer, in years), weight (integer, in kg), height (integer, in cm), runList (list container of Run objects 2)arrow_forward
- in C++ write a “serialize” and “deserialize” function for a map.arrow_forwardTask 4. Utility classes Implement a Menu-Driven program of ArrayList class using the above scenario and perform the following operations. Create an object of ArrayList class based on the scenario with explanations of the method Create a method that will allow inserting an element to ArrayList Class based on the scenario. The input field must be validated as Create a method to delete specific elements in the ArrayList with explanations of the methodarrow_forwardWhat function does this Syntax perform? function myMap() {var map Canvas = document.getElementById("map");var mapOptions = {center: new google.maps.LatLng(51.5, -0.2),zoom: 10};var map = new google.maps.Map(mapCanvas, mapOptions);}arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education