Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

se corrigen todos los paquetes de las clases #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex03_1_exercise;
package sofflix.exercises.ex03_1_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

package ex04_1_exercise;
package sofflix.exercises.ex04_1_exercise;

public class ShoppingCart {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

package ex04_2_exercise;
package sofflix.exercises.ex04_2_exercise;

public class ShoppingCart {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex05_1_exercise;
package sofflix.exercises.ex05_1_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex05_2_exercise;
package sofflix.exercises.ex05_2_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex05_3_exercise;
package sofflix.exercises.ex05_3_exercise;

/**
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sofflix/exercises/ex06_1_exercise/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex06_1_exercise;
package sofflix.exercises.ex06_1_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex06_2_exercise;
package sofflix.exercises.ex06_2_exercise;

import ex06_1_exercise.Item;
import sofflix.exercises.ex06_1_exercise.Item;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex07_1_exercise;
package sofflix.exercises.ex07_1_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex07_2_exercise;
package sofflix.exercises.ex07_2_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex07_3_exercise;
package sofflix.exercises.ex07_3_exercise;

/**
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sofflix/exercises/ex08_1_exercise/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex08_1_exercise;
package sofflix.exercises.ex08_1_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex08_1_exercise;
package sofflix.exercises.ex08_1_exercise;

/**
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sofflix/exercises/ex08_2_exercise/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex08_2_exercise;
package sofflix.exercises.ex08_2_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex08_2_exercise;
package sofflix.exercises.ex08_2_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex09_1_exercise;
package sofflix.exercises.ex09_1_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex09_2_exercise;
package sofflix.exercises.ex09_2_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex09_2_exercise;
package sofflix.exercises.ex09_2_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex10_1_exercise;
package sofflix.exercises.ex10_1_exercise;

/**
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sofflix/exercises/ex10_2_exercise/Order.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex10_2_exercise;
package sofflix.exercises.ex10_2_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex10_2_exercise;
package sofflix.exercises.ex10_2_exercise;

/**
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sofflix/exercises/ex10_3_exercise/Order.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex10_3_exercise;
package sofflix.exercises.ex10_3_exercise;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ex10_3_exercise;
package sofflix.exercises.ex10_3_exercise;

/**
*
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/sofflix/exercises/ex11_1_exercise/ShoppingCart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sofflix.exercises.ex11_1_exercise;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
*
* @author Omar
*/
public class ShoppingCart {
public static void main(String[] args){
// Declare a LocalDateTime object, orderDate
LocalDateTime orderDate;

// Initialize the orderDate to the current date and time. Print it.
orderDate = LocalDateTime.now();
System.out.println(orderDate);
// Format orderDate using ISO_LOCAL_DATE; Print it.
String orderDateFormat = orderDate.format(DateTimeFormatter.ISO_LOCAL_DATE);
System.out.println(orderDateFormat);
}
}
33 changes: 33 additions & 0 deletions src/main/java/sofflix/exercises/ex11_2_exercise/ShoppingCart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sofflix.exercises.ex11_2_exercise;

/**
*
* @author Omar
*/
public class ShoppingCart {
public static void main(String[] args) {
String name;
int age;


if(args.length <2){
// Print an error message if fewer than 2 args are passed in.
System.out.println("Se requieren dos argumentos de entrada...");
}else{
// Parse the args array to populate name and age.
name = args[0];
age = Integer.parseInt(args[1]);
System.out.println("name: "+name);
System.out.println("age: "+age);
}




}
}
65 changes: 65 additions & 0 deletions src/main/java/sofflix/exercises/ex11_3_exercise/Item.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sofflix.exercises.ex11_3_exercise;

/**
*
* @author Omar
*/
public class Item {
private int id;
private String desc;
private double price;
private boolean isBackOrdered;
private static int nextId = 1;

public Item(String desc, double price) {
setId();
this.desc = desc;
this.price = price;
checkStock();
}

private void checkStock(){ // typically would query a database here

// Negative random numbers will result in isBackOrdered = true
double num = Math.random() * 1000;

if ((int)num % 2 == 1 ){
this.isBackOrdered = true;
System.out.println(getDesc() +" is back ordered.");
}
else this.isBackOrdered();
}

private void setId() {
id = Item.nextId++;
}

public int getId() {
return id;
}

public String getDesc() {
return desc;
}

public void setDesc(String desc) {
this.desc = desc;
}

public double getPrice() {
return price;
}

public void setPrice(double price) {
this.price = price;
}

public boolean isBackOrdered() {
return isBackOrdered;
}
}
36 changes: 36 additions & 0 deletions src/main/java/sofflix/exercises/ex11_3_exercise/ShoppingCart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sofflix.exercises.ex11_3_exercise;

/**
*
* @author Omar
*/
public class ShoppingCart {
Item[] items = {new Item("Shirt",25.60),
new Item("WristBand",0),
new Item("Pants",35.99)};

public static void main(String[] args){
ShoppingCart cart = new ShoppingCart();
cart.displayTotal();
}

// Use a standard for loop to iterate through the items array, adding up the total price
// Skip any items that are back ordered. Display the Shopping Cart total.
public void displayTotal(){
double total = 0.0;
for (int i = 0; i < items.length; i++) {
Item item = items[i];
if(!item.isBackOrdered()){
continue;
}else{
total += item.getPrice();
}
}
System.out.println("La suma total de los articulos es : "+ total);
}
}
Loading