Implement MeraSet2 class similar to last assignment, Add following members:
operator =; // assignment operator, makes deep copy
Copy constructor
operator []; // implement subscript operator, to display individual element of a set.
Max continues matrix
Objects with given Fruit
Given an array of objects
objectEntities in the prefilled code and fruit as an input, write a JS program to log the array of objects containing the given fruit.
Input
The input will be a single line containing a string
fruitOutput
The output should be the array of objects matching the given
fruit
Sample Input 1
apple
Sample Output 1
[
{ fruit: 'apple', vegetable: 'broccoli' },
{ fruit: 'apple', vegetable: 'cauliflower' }
]
Sample Input 2
orange
Sample Output 2
[ { fruit: 'orange', vegetable: 'mushrooms' } ]
i want code in between write your code here
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
/* Please do not modify anything above this line */
function main() {
const fruit = readLine();
const objectEntities = [
{
fruit: "apple",
vegetable: "broccoli"
},
{
fruit: "kiwi",
vegetable: "broccoli"
},
{
fruit: "apple",
vegetable: "cauliflower"
},
{
fruit: "orange",
vegetable: "mushrooms"
},
];
/* Write your code here */
}
CONTINUATION 2
alphabet = "abcdefghijklmnopqrstuvwxyz"
test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]
test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog"]
def histogram(s):
d = dict()
for c in s:
if c not in d:
d[c] = 1
else:
d[c] += 1
return d
Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following.
aaa has duplicates
abc has no duplicates
Print a line like one of the above for each of the strings in test_dups.
CONTINUATION......
alphabet = "abcdefghijklmnopqrstuvwxyz"
test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]
test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog.
def histogram(s):
d = dict()
for c in s:
if c not in d:
d[c] = 1
else:
d[c] += 1
return d
Implement has_duplicates by creating a histogram using the histogram function above. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates.
Write a loop over the strings in the provided test_dups list.
Create a base class called shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from the base shape. Add to base class, a member function get_data() to initialize base class data members and another member functions display_area() to compute and display the area of figures. Mark the display_area() as a virtual function and redefine this function in the derived class to suit their requirements.(Use pure virtual function)
Develop a simple payroll application. There are three kinds of employees in the system: salaried employee, hourly employee, and commissioned employee. The system takes as input an array containing employee objects, calculates salary polymorphically, and generates report.
Make Employee an abstract class. Declare salary() and display() as pure virtual functions in it. Derive salaried employee (monthly), hourly employee (per hour basis), and commissioned employee (bonus on completing each target) from base class Employee. The display() function should show employee no, employee name, and salary of all employees.
alphabet = "abcdefghijklmnopqrstuvwxyz"
test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]
test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog"]
def histogram(s):
d = dict()
for c in s:
if c not in d:
d[c] = 1
else:
d[c] += 1
return d
Copy the code above into your program but write all the other code for this assignment yourself.
Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False.
QUESTIONS NOT COMPLETE BUT IT WILL BE CONTINUE.....
Write a program to get number from user until user enter a negative number and show running sum of all the user input.
Write a program to input a number or word from the user and find its reverse. If the reverse is the same as the input then it is a palindrome. Check if the text is a palindrome or not.