Question

In: Computer Science

SWITCH CASE, WHILE, DO WHILE STRUCTURES, using ARDUINO. Urgent Please! Implement the following programs, attach a...

SWITCH CASE, WHILE, DO WHILE STRUCTURES, using ARDUINO. Urgent Please!

Implement the following programs, attach a flow chart, and photos of its operation.
1. Read a number that represents the month and say what months it is.
2. Using the conditional "while" calculate the factorial of a number
3. Using the “do-while” conditional, make a program that prints all numbers from 1 up to a maximum number entered by the user.

Solutions

Expert Solution

PROGRAM 1:



void setup() {
     Serial.begin();
  // modify it according to yourself

}

void loop() {
     Serial.println("Input Month No :");
      int mon_num=Serial.read();
    
   switch(mon_num)
   {
        case 1:
               Serial.println("January");
               break;
        case 2:
               Serial.println("February");
               break;
        case 3:
               Serial.println("March");
               break;
        case 4:
               Serial.println("April");
               break;
        case 5:
               Serial.println("May\n");
               break;
        case 6:
               Serial.println("June");
               break;
        case 7:
               Serial.println("July");
               break;
        case 8:
               Serial.println("August");
               break;
        case 9:
               Serial.println("September");
               break;
        case 10:
               Serial.println("October");
               break;
        case 11:
               Serial.println("November");
               break;
        case 12:
               Serial.println("December");
               break;
        default:
               Serial.println("INvalid Input");
               break;
}

PROGRAM 2



void setup() {
       Serial.begin();
  // modify it according to yourself

}

void loop() {
    int n;
          Serial.println("ENTER A NUMBER:");
          n=Serial.read();
        int fact = 1;
        while(n>1)
        {
            fact=fact*n;
            n--;
        }
        Serial.println(fact);
}


FLOWCHART

PROGRAM 3

void setup() {
      Serial.begin();
  // modify it according to yourself
}

void loop() {
    int n;
    Serial.println("Enter number of elements you want to enter:");
          n=Serial.read();
          int a[n];

        int max = -99999;
        int i = 0;
        do{
            Serial.println("ENTER NUMBER:");
            Serial.println(i+1);
            a[i]=Serial.read();
            if(a[i] > max)
            {
                max=a[i];
            }
            i++;
        }while(i!=n);
        Serial.println("Larger number = ");
  Serial.println(max);
}

FLOWCHART


Related Solutions

SWITCH CASE, WHILE, DO WHILE STRUCTURES Implement the following programs, attach a flow chart, and photos...
SWITCH CASE, WHILE, DO WHILE STRUCTURES Implement the following programs, attach a flow chart, and photos of its operation. 1. Read a number that represents the month and say what months it is. 2. Using the conditional "while" calculate the factorial of a number 3. Using the “do-while” conditional, make a program that prints all numbers from 1 up to a maximum number entered by the user.
PLEASE ANSWER (URGENT) Service marketing Case study: PI-O’s Please read the following case and answers this...
PLEASE ANSWER (URGENT) Service marketing Case study: PI-O’s Please read the following case and answers this question: 1- How can you help PI-O in determining and minimizing their customers’ expected risks (Functional risk, Financial risk, Temporal risk, Physical risk, Psychological risk, and Social risk)? Identify the expected risks and suggest solutions? Justify your answer. For more than 35 years, PI-O’s has been one of the nation’s go-to venues for children’s birthday parties and rainy afternoon outings. Operating under the slogan...
The following is a set of tree-set test programs that show the following outputs: Switch to...
The following is a set of tree-set test programs that show the following outputs: Switch to ArrayList, LinkedList, Vector, TreeMap, and HashMap to display similar output results. Results: Tree set example! Treeset data: 12 34 45 63 Treeset Size: 4 First data: 12 Last Data: 63 Removing data from a tree set Current tree set elements: 12 34 63 Current tree set size :3 Tree set empty. Example code import java.util.Iterator; import java.util.TreeSet; public class TreeDemo2 { public static void...
Question:   Can you please convert this program into switch case program using c++. Output should be...
Question:   Can you please convert this program into switch case program using c++. Output should be same int main() {     bool weekend = false;     unsigned char day = 0;     bool isDay = true;     cout << " Enter a char for a day of week:";     cin >> day ;     if (day == 'M' || day == 'm')         cout << " This is Monday" << endl ;     else if (day == 'T' || day...
C++(screenshot output please) Part 2 - Tree programs Program 1 Implement a tree using an array...
C++(screenshot output please) Part 2 - Tree programs Program 1 Implement a tree using an array Program 2 Implement a tree using linked list - pointer Binary Tree Program 3 - Convert program 1 to a template
Linked List Course Outcome: CLO3    Build computer programs to implement appropriate data structures for solving computing...
Linked List Course Outcome: CLO3    Build computer programs to implement appropriate data structures for solving computing problems in a time frame given. (P3, PLO3) Task Write a complete program by applying linked list data structure that will perform the following operation on any records: Add record Delete record View record Find record Your program also should be able to display the number of record in the linked list. Put your creativity to produce the program. Your Submission should have the...
***Using Java Using the switch/case construct, write a program that takes a character from the user...
***Using Java Using the switch/case construct, write a program that takes a character from the user and classifies it as a number (‘1’,’2’, ‘3’, …), a letter from the alphabet (‘A’, ‘a’, ‘B’, ‘b’, …, ‘Z’, ‘z’), an arithmetic operator (‘+’, ‘-‘, ‘/’, ‘*’, ‘%’), a comparison operator (‘<’, ‘>’, ‘=’), punctuation (‘!’, ‘?’, ‘,’, ‘,’, ‘:’, ‘;’), and all other characters as a Special Character, and informs the user of the same. If the user entered the character A,...
Explain why dyes attach to natural fibers more readily than synthetic fibers. How do the structures relate?
Explain why dyes attach to natural fibers more readily than synthetic fibers. How do the structures relate?
Using Arduino , TCNT0 with PWM How do you pick a prescaler and OCR0A to get...
Using Arduino , TCNT0 with PWM How do you pick a prescaler and OCR0A to get a frequency of 1 k Hz
*****Urgent Please !!!! Please answer using ---- RESEARCH QUESTION - ( How has the COVID-2019 pandemic...
*****Urgent Please !!!! Please answer using ---- RESEARCH QUESTION - ( How has the COVID-2019 pandemic affected mental health among hospital employees? )***** 1. What is your research question? 2. Does your research question meet the FINER criteria? Please explain 3. Provide some background and significance. 4. What is your proposed study design? What is your time frame? 5. What is your justification for your proposed study design. 6. Who is your proposed study population? What are the selection criteria?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT