Jump to content


Photo

Algoritmo Para Caixa Eletronico


  • Faça o login para participar
5 replies to this topic

#1 Rubia Matos

Rubia Matos

    Novato no fórum

  • Usuários
  • 2 posts
  • Sexo:Feminino
  • Localidade:Caxias do Sul
  • Interesses:Quero dividir o meu conhecimento e também aprender muito aqui nesse fórum.

Posted 30/11/2011, 16:40

Pois bem esse é meu primeiro post, estou cursando Técnico em Informática e tendo claro algumas dificuldades em relação a alguns exercicios de logica.Em meio a uma grande dificuldade de resolver alguns algoritmos entrava em fóruns procurando uma resposta, mas nem sempre encontrava a resposta certa então decidi me cadastrar e colocar aqui o que eu sei podendo ajudar quem procura as mesmas respostas que eu.
E ai vai o primeiro:

Bits Trocados

Em um pequeno país do planeta Cyber , a moeda vigente é o bit cuja sigla é B$. Nesta moeda existem cédulas de B$25.00, B$15.00, B$2.00 e B$1.00 bits. Você foi contratado para implementar o sistema de saques em um caixa eletrônico e, para isso, você deverá sempre liberar o menor número de notas possíveis para um determinado valor solicitado. O seu algoritmo terá como dado de entrada o valor a ser retirado do caixa e deverá emitir o total de cada nota necessário para compor o valor solicitado (emitindo o mínimo possível de notas).
Obs: Nenhum saque poderá exceder B$1000.00 bits.


Resolvi esse exercìcio em java depois de uns 15 dias ele ficou assim e funcionando bem:


import java.util.Scanner;

public class CaixaEletronico {
Scanner scanInt = new Scanner(System.in);
public void saque() {
int nota25 = 0, nota15 = 0, nota2 = 0, nota1 = 0;
System.out.println("Informe o valor que deseja sacar:");
int valor = scanInt.nextInt();

if (valor > 1000) {
System.out.println("SAQUE NAO REALIZADO! Valor invalido");
} else if (valor <= 0) {
System.out.println("SAQUE NAO REALIZADO! Valor invalido");
} else {
int valorAux = valor;
int resto = 0, divisao = 0;
if (valorAux >= 25) {
divisao = valorAux / 25;
nota25 = divisao;
resto = valorAux % 25;
valorAux = resto;
}

if (valorAux >= 15) {
divisao = valorAux / 15;
nota15 = divisao;
resto = valorAux % 15;
valorAux = resto;
}

if (valorAux >= 2.0) {
divisao = valorAux / 2;
nota2 = divisao;
resto = valorAux % 2;
valorAux = resto;
}

if (valorAux >= 1.0) {
nota1 = valorAux;
valorAux = valorAux - nota1;

}

System.out.println("SAQUE VALIDO! VOCE DEVERA RECEBER:");
if (nota25 > 0) {
System.out.println(nota25 + " cedula(s) de B$25");
}

if (nota15 > 0) {
System.out.println(nota15 + " cedula(s) de B$15");
}

if (nota2 > 0) {
System.out.println(nota2 + " cedula(s) de B$2");
}

if (nota1 > 0) {
System.out.println(nota1 + " cedula(s) de B$1");

}

}

}
public static void main(String args[]){
new CaixaEletronico();
}
}

Edição feita por: Rubia Matos, 30/11/2011, 16:41.


#2 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 25/10/2017, 20:38

Propecia Quartiere Frontale Viagra 35 Ans cialis Viagra Billig Online Effetti Levitra

#3 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 11724 posts

Posted 26/10/2017, 05:58

Side Effects Cephalexin Azithromycin Overnight Delivery viagra Best Life Rx Medicamentos Cialis Efectos Secundarios

#4 aapedlok

aapedlok

    24 Horas

  • Usuários
  • 450 posts
  • Sexo:Masculino
  • Localidade:Alpharetta

Posted 06/11/2017, 05:43

Discounts! awesome product websites progect12.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE порядок затяжки гбц ваз8a pre plucked 360 lace frontal closure brazilian virgin hair straight 360 frontal with natural hairline baby hair frontals 360 ( 186.00 $)Large Saffiano Leather Tote ( 138.60 $)Multicolor Manga Print Flat Clutch ( 170.00 $)шкив коленвала 405 двигательZmodo ZH-IZV15-WAC Smart Pan Tilt WiFi Camera-104.69 $Popeye black patchwork bucket bag wstuds and fringes ( 492.15 $) Jerome Dreyfuss80pcsbag Quality 30mm Child baby Small Rubber Bands Elastic Ponytail Holders Hair Ring Accessories Girl Rubber Bands Tie Gum ( 2.45 $)condition zero торрентSolid White Extra-Long Pure Silk Tie ( 47.04 $)Sweet women's push up embroidered adjustable lace bra set ( 15.65 $)Marrant crazy horse genuine leather bag casual men handbags men crossbody bags men s travel bag ( 98.00 $)Geo Print Zip Around Wallet ( 145.00 $)Zolotaya malina (premiya, 1984)Sleeveless pu over hip dress for women ( 9.59 $) 44bb.jpg
Discounts! the best products

progect12.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
complete +and draw перевод +на русский
New Arrival 3Pcs Elephant Wrap Charm Bracelet Gold Filled Fish Star Crystal Bangles Silver Bracelets for Women Jewelry 2016 ( 3.34 $)
Women Sexy Lingerie Lady Long Lace Mesh Lingerie Night Sleepwear Babydoll Dress G-String S-M Exotic Apparel Underwear Nightgown ( 11.50 $)
Space 8GB Ram+500GB HDD+64GB SSD Windows 10 System Ultrathin Quad Core Fast Boot Laptop Notebook Netbook Computer,free shipping ( 339.00 $)
Defeway 8ch 1080n hdmi dvr 1200tvl 720p hd outdoor security camera system 8 channel cctv surveillance dvr kit ahd camera set ( 142.99 $)
bird collect bottle
Everbuying: China Wholesale Online Shopping - Buy from China at Cheap Prices
Unprocessed virgin peruvian full lace wig black women lace front wigs full lace human hair wigs with bangs african american wigs ( 101.00 $)
метка шкива коленвала газ 406
Elegant faux crystal silvery crossed bikini body chain for women ( 2.21 $)
Oderzhimost (film, 2014)
Trendy round toe and pu leather design casual shoes for men ( 27.73 $)
Vortice - Lime Murano Glass Swirling Drop Necklace ( 60.00 $)
DOOGEE X3 3G Smartphone-61.22 $
птички ангри берс игры


108.jpg
Discounts! best hair styling cream progect12.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE магазин кеддо +в москветарелка клапана нижняя 2112Portable Whale Style Ultrasonic Humidifier-6.82 $Sendefn large capacity lady party fashion long purse patent leather women wallets female clutch bag casual card holder purse ( 43.48 $)14 Colors Promotion New Design Stud Earrings Glass Stone European Brand Silver Plated Earrings Fashion Black Earrings For Women ( 1.32 $)скачать grand theft auto iii через торрентLuminaire water pipe lamp retro loft style lampe vintage industrial pendant lighting fixtures iron painting american country ( 110.98 $)RECESKY AKARI DIY Origami Folding Paper Lamp-12.62 $2015 best anti radar car detector strelka alarm system brand car radar laser radar detector str 535 for russian car-detector ( 41.99 $)Bicycle Accessories Bisiklet Aksesuar 128 LED Bicycle light Bike LED Wheel Light Colorful Changing Pattern Light Night For MTB ( 59.98 $)Sunflower Airtight Seal Ceramic Canister ( 43.25 $)Stylish sequined cloth and tie up design women's athletic shoes ( 30.38 $)Stylish Hooded Long Sleeve Solid Color Pocket Design T-Shirt For Women $17.63Charm in hands elegant alligator patent leather women handbag big women's shoulder bags cross lock design lady tote handbag ( 26.80 $)Greenwich scarlet leather mini flap crossbody ( 183.48 $) DKNY 2.jpg
Discounts! top rated beauty products

progect12.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
2PCS Waterproof Cree Chip u7 Led Car Motorcycle Headlight 125w 12v Headlight Motorbike Driving Spot Led Fog Light Lamp 2016 ( 48.47 $)
Auran Uoters â Game of Thrones
Mermaid blanket ,pattern crochet mermaid tail,knitted mermaid tail blanket adult child 31''71'' ( 19.90 $)
Water Drop-shaped Necklace Pendant Case for Xiaomi Miband / 1S ( $1.83 )
Chic rhinestoned round shape bracelet for women ( 5.14 $)
Men's Plaid Shirts 2016 Fashion Long Sleeve Slim Fit Cotton Shirt Free Styles Man Clothes Mens Shirt!Asian size, not USEU size ( 7.91 $)
2600mah Unicorn power bank Cute Portable Emoji Power Bank Charger Cartoon USB Battery Bateria For Iphone 4 5 6 Xiaomi Sony LG ( 11.99 $)
Modern style scoop neck hooded high waist long sleeve faux leather women's coat ( 31.77 $)
2 pieceslot 6inch 18w mini led bar 12v led work light spot flood fog lamp for offroad boat truck atv 4x4 led driving light ( 24.49 $)
Sterling Silver Deer Pendant Necklace ( 120.00 $)
Fitness american football pants seahawks 3d printed sports leggings yoga pants exercise women running tights sm4l028 ( 12.49 $)
ремонт гбц +в иркутске
Kerui android ios app 433mhz sensor dual-network gsm pstn with anti-pet pir self-check door sensor home burglar security alarm ( 125.99 $)
Shokolad Bena Rassmusena. (Video)
Holly rope and luggage leather platform sandal ( 112.33 $) Michael Kors


33.jpg

#5 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 07/11/2017, 20:08

Tadalis Sx Soft Tabs Cialis Vente En Pharmacie Stendra Where To Buy cialis Propecia Studios Priligy On The Nhs

#6 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 30/11/2017, 04:35

Achat De Propecia En Espagne No Perscription Azithromocin Tablets Achat Kamagra Pas Cher generic cialis Viagra In Canada
Kamagra Alicante Propecia Testosterona Propecia Side Effects Months cialis Zithromax 1 Dose Buy Viagra In Cyprus 282
Flushed Face Amoxicillin Lasix Kopen viagra Noble Drug Store Reviews




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq