Você está na página 1de 24

UNIVERSIDADE FEDERAL DO PAR

INSTITUTO DE CINCIAS EXATAS E NATURAIS


FACULDADE DE COMPUTAO

PROGRAMAO II
Apresentao da Classe iPad
Aluno: Edson Alessandro F. Costa

Docente: Claudomiro de Souza de Sales Junior

DIAGRAMA UML (ATRIBUTOS)

DIAGRAMA UML (MTODOS PBLICOS)

DIAGRAMA UML (MTODOS PRIVADOS)

ATRIBUTOS DA CLASSE IPAD

Atributos
bool isTurnedOn;
float storageCapacity; // Measured in GB

float freeMemory; // Measured in GB


string lockScreenPassword;
bool screenLocked;
bool wiFiOn;
bool mobileDataOn;

unordered_map<string, float> appsInstalled;


vector<string> activeApps;

MTODOS DA CLASSE IPAD


Mtodos
void turnOn();

void getInformation();

void turnOff();

bool closeAllApps();

bool installApp(const string &, float);

bool uninstallAllApps();

bool uninstallApp(const string &);

bool unlockScreen();

bool openApp(const string &) ;

bool lockScreen();

bool closeApp(const string &);

void turnWiFiOnOff();

void showAppsInstalled();

void turnMobileDataOnOff();

void showActiveApps();

MTODOS DA CLASSE IPAD

Funes Auxiliares

Construtores

bool isOn();

IPad();

bool isAppInstalled(const string &);

IPad(int storage);

bool isAppOpen(const string &);

bool isIPadEmpty();
void setSpecsToDefault();
void installDefaultApps();
bool validateValue(float, float, float, const string &);
bool setLockScreenPassword();

bool isScreenUnlocked();

CONSTRUTORES
IPad::IPad()
{

cout << ".:. iPad Creation .:.\n";


setSpecsToDefault();

installDefaultApps();
setLockScreenPassword();

}
IPad::IPad(int storage)
{
cout << ".:. iPad Creation .:.\n";
setSpecsToDefault();
storageCapacity = validateValue(storage, 16, 128, "storage capacity");
installDefaultApps();
setLockScreenPassword();
}

CONSTRUTOR VAZIO
IPad::IPad()
{

cout << ".:. iPad Creation .:.\n";


setSpecsToDefault();

installDefaultApps();
setLockScreenPassword();

void IPad::setSpecsToDefault()
{
isTurnedOn = true;
storageCapacity = 32;
freeMemory = storageCapacity;
screenLocked = false;
wiFiOn = true;
mobileDataOn = false;
}

CONSTRUTOR VAZIO
IPad::IPad()
{

cout << ".:. iPad Creation .:.\n";


setSpecsToDefault();

installDefaultApps();
setLockScreenPassword();

IPad::void installDefaultApps()
{
appsInstalled["Google"] = 200;
freeMemory -= 200/1000.0;
appsInstalled["Safari"] = 100;
freeMemory -= 100/1000.0;
appsInstalled["YouTube"] = 50;
freeMemory -= 50/1000.0;
}

CONSTRUTOR VAZIO
IPad::IPad()
setLockScreenPassword();

void IPad::setLockScreenPassword()
{
string password;
while (true)
{
cout << "\n>> Set initial password to lock screen (4-32 chars): ";
getline(cin, password);
if ((password.length() >= 4) && (password.length() <= 32))
{
lockScreenPassword = password;
cout << "\n|| Lock screen password set successfully ||\n";
break;
}
cout << "\n# Password must be 4 to 32 chars. Try again. #\n";

}
}

MTODO INSTALAR APLICATIVO


bool IPad::installApp(const string &name, float sizeOfApp)
{
if (not isAppInstalled(name)) // Check to see if the app isn't already installed
{
if (sizeOfApp/1000 <= freeMemory) // Check if there is enough space
{
appsInstalled[name] = sizeOfApp;
freeMemory -= sizeOfApp/1000;
cout << "|| The app " << name << " was successfully installed. ||";
return true;
} else {
cout << "\nThere isn't enough space to install " << name << .";
return false;
}
} else {
cout << "\n# App " << name << " is already installed. #\n";
return false;
}
}

MTODO DESINSTALAR APLICATIVO


bool IPad::uninstallApp(const string &name)
{
if (isAppInstalled(name)) // Check to see if the app is indeed installed
{
cout << "\n|| Uninstalling " << name << "... ||\n";

closeApp(name); // Close the app, in case it is open


freeMemory += appsInstalled[name]/1000; // The memory the app held is set free.
appsInstalled.erase(name); // Proceed to erase the app.

cout << "\n|| The app " << name << " was successfully uninstalled. ||\n";
return true;
} else {
cout << "\n# The app " << name << " isn't installed. #\n";
return false;
}
}

MTODO ABRIR APLICATIVO


bool IPad::openApp(const string &name)
{
if (isAppInstalled(name)) // Check to see if the app is installed
{
if (not isAppOpen(name)) // Check to see if the app isn't already open
{
activeApps.push_back(name);
cout << "\n|| App " << name << " was successfully opened. ||\n";
return true;
} else {
cout << "\n# App " << name << " is already opened. #\n";
return false;
}
} else {
cout << "\n# Couldn't open app " << name << ", because it isn't installed. #\n";
return false;
}
}

MTODO DESINSTALAR TODOS APPS


bool IPad::uninstallAllApps()
{
if (not appsInstalled.empty()) // Check to see if there is any app in the device
{
activeApps.clear(); // Close all apps

appsInstalled.clear(); // Uninstall all apps


freeMemory = storageCapacity; // Reset memory to its initial state
cout << "\n\n|| All apps were uninstalled ||\n\n";

return true;
} else
{
cout << "\n\n|| There are no apps in the iPad. ||\n\n";
return false;
}
}

MAIN
Funcionamento do Programa Principal
.: iPad Control Center :.
1 => Show Open Apps

2 => Install App

3 => Uninstall App

4 => Show Apps Installed

5 => Get iPad Information

6 => Open App

7 => Close App

8 => Close All Apps

9 => Uninstall All Apps

10 => Turn Wi-Fi On

11 => Turn Wi-Fi Off

12 => Turn Mobile Data On

13 => Turn Mobile Data Off

14 => Unlock Screen

15 => Lock Screen

16 => Turn On

17 => Turn Off

18 => Quit

>> Enter your choice:

MAIN
Funcionamento do Programa Principal

MAIN
Funcionamento do Programa Principal

MAIN
Funcionamento do Programa Principal

MAIN
Funcionamento do Programa Principal

MAIN
Funcionamento do Programa Principal

MAIN
Funcionamento do Programa Principal

MAIN
Funcionamento do Programa Principal

MAIN
Funcionamento do Programa Principal

Você também pode gostar