Functional Programming Answers

Questions: 109

Answers by our Experts: 81

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

2 a. Write a program to using the principle of control structures (if /else statements) determine which the students grade, based on the marks numbers entered by the user (Using the table below). (10pts)

 

From

To

Grade

90

100

A

80

89

B

70

79

C


69

F

 


write a function (called ubbi_dubbi) that takes a single word (string) as an argument. It returns a string, the word’s translation into Ubbi Dubbi. So if the function is called with octopus, the function will return the string uboctubopubus. And if the user passes the argument elephant, you’ll output ubelubephubant.


Fact-Finding Summary

• A typical center has 300–500 members, with two membership levels: full and limited. Full members have access to all activities. Limited members are restricted to activities they have selected, but they can participate in other activities by paying a usage fee. All members have charge privileges. Charges for merchandise and services are recorded on a charge slip, which is signed by the member.

Tasks

1. Draw a DFD that shows how data will be stored, processed, and transformed in the TIMS system.

2. Draw an FDD that shows the Personal Trainer’s main functions. Also draw a use case diagram that represents the interaction between a user and the proposed TIMS system.

3. Using the information gathered during fact-finding, develop a requirements checklist that includes examples in each of the five main categories.



Write a regular expression for the following languages, over sigma=(a,b) All strings that do not end with aa.All strings that contain an even number of b’s. All strings which do not contain the substring ba.


Construct NFA for the regular Expression R=(a+b) ∗abb


Draw DFAs for the regular expression R= a ∗ (ba∗ ba∗ ) ∗


What is the importance of automata theory? Where it can be applied? What is the basic unit of language? Show the examples


2. You have just purchased a new personal computer system. Before putting the system components together, you read the instruction booklet that came with the system. The booklet contains a list of the components that you should have received. The booklet advises you to verify that you received all of the components by matching those that you received with those on the list. If a component was received you should cross its name off the listotherwise, you should draw a circle around the component name in the list. Using only the instructions listed in the Figure belowcreate an algorithm (step-by-step instructions) that shows the steps you should take to verify that you received the correct components. Be sure to indent the instructions appropriately circle the component name the list cross the component name off the list else end if end repeat if (the component was received) read the component name from the list repeat for each component wave the list) for the component


– If a programmer chooses java, a special approach is used. Identify one feature of this special approach. 


Mobile

You are given an incomplete

Mobile class.A Mobile object created using the

Mobile class should have the properties like brand, ram, battery, isOnCall, and song.Implement the

Mobile class to initialize the mentioned properties and add the following methods,


Method:- charging

Description:- When this method is called, it should set the value of the battery to 100, if the battery is already 100 then log "Mobile Fully Charged" and call removeCharging


method:- removeCharging

Description:- It should log "Please remove charging".


method:- playMusic

Description:- It should log a text with the song, as shown in the sample output


method:- stopMusic

Description:- It should log "Music Stopped"


method:- makeCall

Description:- When this method is called, it should set the value of the isOnCall to true and log 

"Calling ..."


method:- endCall

Description:- When this method is called, it should log "No ongoing call to end" if isOnCall is false, else log "Call Ended" and set the value of the isOnCall to false.


Input

  • The first line of input contains a string brand
  • The second line of input contains a string ram
  • The third line of input contains a number battery
  • The fourth line of input contains a string song
  • The fifth line of input contains a boolean isOnCall

Output

  • The first line of output is a string containing
  • battery before charging, as shown in the sample outputs
  • The second line of output is a string based on
  • battery, as shown in the sample outputs
  • The third line of output is a string containing
  • song, as shown in the sample outputs
  • The fourth line of output is a string "Music stopped"
  • The fifth line of output is a string "No ongoing call to end" or "Call Ended"
  • The sixth line of output is a string "Calling..."
  • The seventh line of output is a string "Call Ended"

Constraints

0 <=

battery <= 100


Sample Input 1

Apple

2 GB

90

Waka Waka

false


Sample Output 1

Mobile charged 90%

Mobile charged 100%

Playing Waka Waka song

Music stopped

No ongoing call to end

Calling...

Call Ended


Sample Input 2

Samsung

8 GB

100

Gangnam Style

true


Sample Output 2

Mobile charged 100%

Mobile is fully charged

Please remove charging

Playing Gangnam Style song

Music stopped

Call Ended

Calling...

Call Ended




LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS