Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program in C++ to count the words “this” and “these” present in a text file “ARTICLE.TXT”. Use file handling concept.


1. Consider the loop from Section 8.3 of your textbook.


prefixes = 'JKLMNOPQ'

suffix = 'ack'

for letter in prefixes:

   print(letter + suffix)

Put this code into a Python script and run it. Notice that it prints the names "Oack" and "Qack".

Modify the program so that it prints "Ouack" and "Quack" but leaves the other names the same.

Include the modified Python code and the output in your submission.

2. Give at least three examples that show different features of string slices. Describe the feature illustrated by each example. Invent your own examples. Do not copy them for the textbook or any other source.

Part 2

Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between my_sqrt(a) and math.sqrt(a). 

a = 6 | my_sqrt(a) = 2.44948974278 | math.sqrt(a) = 2.44948974278 | diff = 0.0

a = 7 | my_sqrt(a) = 2.64575131106 | math.sqrt(a) = 2.64575131106 | diff = 0.0

a = 8 | my_sqrt(a) = 2.82842712475 | math.sqrt(a) = 2.82842712475 | diff = 4.4408920985e-16

a = 9 | my_sqrt(a) = 3.0 | math.sqrt(a) = 3.0 | diff = 0.0 

Modify your program so that it outputs lines for a values from 1 to 25 instead of just 1 to 9. 

You should submit a script file and a plain text output file (.txt) that contains the test output. Multiple file uploads are permitted.



Part 2

Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between my_sqrt(a) and math.sqrt(a). 

a = 1 | my_sqrt(a) = 1 | math.sqrt(a) = 1.0 | diff = 0.0

a = 2 | my_sqrt(a) = 1.41421356237 | math.sqrt(a) = 1.41421356237 | diff = 2.22044604925e-16

a = 3 | my_sqrt(a) = 1.73205080757 | math.sqrt(a) = 1.73205080757 | diff = 0.0

a = 4 | my_sqrt(a) = 2.0 | math.sqrt(a) = 2.0 | diff = 0.0

a = 5 | my_sqrt(a) = 2.2360679775 | math.sqrt(a) = 2.2360679775 | diff = 0.0

 

Modify your program so that it outputs lines for a values from 1 to 25 instead of just 1 to 9. 

You should submit a script file and a plain text output file (.txt) that contains the test output. Multiple file uploads are permitted.



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.


Part 1

Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a. 

while True:

   y = (x + a/x) / 2.0

   if y == x:

     break

   x = y 


Each of the following Python functions is supposed to check whether its argument has any lowercase letters.


For each function, describe what it actually does when called with a string argument. If it does not correctly check for lowercase letters, give an example argument that produces incorrect results, and describe why the result is incorrect.


# 3

def any_lowercase3(s):

   for c in s:

     flag = c.islower()

   return flag


# 4

def any_lowercase4(s):

   flag = False

   for c in s:

     flag = flag or c.islower()

   return flag


# 5

def any_lowercase5(s):

   for c in s:

     if not c.islower():

        return False

   return True



 Write a programe to demonstrate the Operator Overloading for any unary and binary operator with expression using both operators together in that expression.


Develop a Console Application to maintain the Contact details of Guests staying at Guest House. Use Layering concept. The class Diagram (The faculty will share the copy of the class Diagram)


Validations :

• All fields compulsory

• guestID should be 3 digits long

• guestName can accept alphabets only. It should start with Capital Alphabet and should have minimum 3 characters

• contactNumber should have 10 digits exctly. It should start with 6 or 7 or 8 or 9.


Create the array of suppliers and store this collection of suppliers in JSON object using JSON Serialization 


LATEST TUTORIALS
APPROVED BY CLIENTS