Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A student can only pass a course so long as they meet the following lab attendance criteria: They missed fewer than 2 labs They were

A student can only pass a course so long as they meet the following lab
attendance criteria:
They missed fewer than 2 labs
They were never late for 3 consecutive labs
Demonstrators record a string representing a student's track record -'A' for
absent,'L' for late, 'P' for present
Write a recursive program that takes in one of these strings and outputs
whether the student should fail or not. If you can't think of how to do it
recursively then just do it in any way!
Example 1:
Input: PPALLP
Output: PASS
Explanation: The student has fewer than 2 absences and was never late for 3 or
more consecutive labs
Example 2:
Input: PPALLLPPPPPPP
Output: FAIL
Explanation: The student was late 3 for consecutive labs
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions