Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad


laboratorio programacion, Apuntes de Programación C

laboratorio programacion codigo c++

Tipo: Apuntes

2022/2023

Subido el 16/10/2023

ferney-mateo-camacho-sandoval
ferney-mateo-camacho-sandoval 🇨🇴

2 documentos

1 / 2

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
Laboratory 08: Object-Oriented Programming (OOP) (Valid grade for the second cut).
The submission deadline for the assignment is Tuesday, October 17th, at 23:59 hours, via
the virtual platform. The submission should not be delayed beyond this deadline. The
assignment allows a maximum of two students to collaborate. Please note that groups
consisting of three students will not be permitted under any circumstances. Only one of the
two students should upload the report to Moodle.
The report for the assignment is expected to be written in English. Additionally, you are
required to present the assignment in class on Wednesday, October 18th.
Your adherence to these deadlines and presentation requirements is appreciated.
This challenge is about using a collection (list) of integers and allowing the user
to select options from a menu to perform operations on the list.
Your program should display a menu options to the user as follows:
P - Print numbers
A - Add a number
M - Display mean of the numbers
S - Display the smallest number
L - Display the largest number
Q - Quit
Enter your choice:
The program should only accept valid choices from the user, both upper and lowercase selections
should be allowed.
If an illegal choice is made, you should display, "Unknown selection, please try again" and the menu
options should be
displayed again.
If the user enters 'P' or 'p', you should display all of the elements (ints) in the list.
If the list is empty you should display "[] - the list is empty"
If the list is not empty then all the list element should be displayed inside square brackets separated
by a space.
For example, [ 1 2 3 4 5 ]
If the user enters 'A' or 'a' then you should prompt the user for an integer to add to the list
which you will add to the list and then display it was added. For example, if the user enters 5
You should display, "5 added".
Duplicate list entries are OK
If the user enters 'M' or 'm' you should calculate the mean or average of the elements in the list and
display it.
If the list is empty you should display, "Unable to calculate the mean - no data"
pf2

Vista previa parcial del texto

¡Descarga laboratorio programacion y más Apuntes en PDF de Programación C solo en Docsity!

Laboratory 08: Object-Oriented Programming (OOP) (Valid grade for the second cut).

The submission deadline for the assignment is Tuesday, October 17th, at 23:59 hours, via

the virtual platform. The submission should not be delayed beyond this deadline. The

assignment allows a maximum of two students to collaborate. Please note that groups

consisting of three students will not be permitted under any circumstances. Only one of the

two students should upload the report to Moodle.

The report for the assignment is expected to be written in English. Additionally, you are

required to present the assignment in class on Wednesday, October 18th.

Your adherence to these deadlines and presentation requirements is appreciated.

This challenge is about using a collection (list) of integers and allowing the user to select options from a menu to perform operations on the list. Your program should display a menu options to the user as follows: P - Print numbers A - Add a number M - Display mean of the numbers S - Display the smallest number L - Display the largest number Q - Quit Enter your choice: The program should only accept valid choices from the user, both upper and lowercase selections should be allowed. If an illegal choice is made, you should display, "Unknown selection, please try again" and the menu options should be displayed again. If the user enters 'P' or 'p', you should display all of the elements (ints) in the list. If the list is empty you should display "[] - the list is empty" If the list is not empty then all the list element should be displayed inside square brackets separated by a space. For example, [ 1 2 3 4 5 ] If the user enters 'A' or 'a' then you should prompt the user for an integer to add to the list which you will add to the list and then display it was added. For example, if the user enters 5 You should display, "5 added". Duplicate list entries are OK If the user enters 'M' or 'm' you should calculate the mean or average of the elements in the list and display it. If the list is empty you should display, "Unable to calculate the mean - no data"

If the user enters 'S' or 's' you should display the smallest element in the list. For example, if the list contains [2 4 5 1], you should display, "The smallest number is 1" If the list is empty you should display, "Unable to determine the smallest number - list is empty" If the user enters 'L' or 'l' you should display the largest element in the list For example, if the list contains [2 4 5 1], you should display, "The largest number is 5" If the list is empty you should display, "Unable to determine the largest number - list is empty" If the user enters 'Q' or 'q' then you should display 'Goodbye" and the program should terminate. Before you begin. Write out the steps you need to take and decide in what order they should be done. Think about what loops you should use as well as what you will use for your selection logic. This exercise can be challenging! It may likely take a few attempts before you complete it -- that's OK! Finally, be sure to test your program as you go and at the end. Hint: Use a vector! Additional functionality if you wish to extend this program.

  • search for a number in the list and if found display the number of times it occurs in the list
  • clearing out the list (make it empty again) (Hint: the vector class has a .clear() method)
  • don't allow duplicate entries
  • come up with your own ideas!

The code must be able to be copied and pasted

To accomplish this, kindly adhere to the sequential stages of the programming

methodology:

• Problem Analysis.

• Problem Specification.

• Algorithm Design.

• Algorithm Testing and Refinement.

• Code Implementation.

• Testing and Verification.